Skip to content

Commit

Permalink
Prepare release (#1)
Browse files Browse the repository at this point in the history
- Disable the job that publishes docker images.
- Allow github-actions to write artifacts.
  • Loading branch information
AlexITC authored Feb 20, 2024
1 parent a8f403e commit 1df13c2
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 80 deletions.
163 changes: 83 additions & 80 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- develop
pull_request:

permissions:
contents: write # to publish artifacts

jobs:
test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -69,83 +72,83 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish_to_docker:
needs: test
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v6
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Docker login
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Get current version
id: ver
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
- name: Get app base directory (distroless)
id: baseDirectoryDistroless
run: |
export BASE_DIRECTORY_DISTROLESS=$(sbt "project igluServerDistroless" baseDirectory -Dsbt.log.noformat=true | sed -n '/\[info\]/ s/\[info\] //p' | tail -1 | tr -d '\n')
echo "::set-output name=directory::$BASE_DIRECTORY_DISTROLESS"
- name: Stage the Docker build
run: sbt "project igluServer" docker:stage
- name: Stage the Docker distroless build
run: sbt "project igluServerDistroless" docker:stage
- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: snowplow/iglu-server
tags: |
type=raw,value=latest,enable=${{ !contains(steps.ver.outputs.tag, 'rc') }}
type=raw,value=latest-focal,enable=${{ !contains(steps.ver.outputs.tag, 'rc') }}
type=raw,value=${{ steps.ver.outputs.tag }}
type=raw,value=${{ steps.ver.outputs.tag }}-focal
flavor: |
latest=false
- name: Docker metadata distroless
id: meta-distroless
uses: docker/metadata-action@v3
with:
images: snowplow/iglu-server
tags: |
type=raw,value=latest-distroless,enable=${{ !contains(steps.ver.outputs.tag, 'rc') }}
type=raw,value=${{ steps.ver.outputs.tag }}-distroless
flavor: |
latest=false
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Push image
uses: docker/build-push-action@v2
with:
context: target/docker/stage
platforms: linux/amd64,linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
push: true
- name: Push distroless image
uses: docker/build-push-action@v2
with:
context: ${{ steps.baseDirectoryDistroless.outputs.directory }}/target/docker/stage
platforms: linux/amd64,linux/arm64/v8
tags: ${{ steps.meta-distroless.outputs.tags }}
push: true
- name: Build local distroless image, which is needed to run Snyk
if: ${{ !contains(steps.ver.outputs.tag, 'rc') }}
run: sbt "project igluServerDistroless" docker:publishLocal
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/docker@master
if: ${{ !contains(steps.ver.outputs.tag, 'rc') }}
with:
image: "snowplow/iglu-server:${{ steps.ver.outputs.tag }}-distroless"
args: "--app-vulns --org=data-processing-new"
command: monitor
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
# publish_to_docker:
# needs: test
# if: startsWith(github.ref, 'refs/tags/')
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: coursier/cache-action@v6
# - name: Set up JDK 11
# uses: actions/setup-java@v1
# with:
# java-version: 11
# - name: Docker login
# run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
# env:
# DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# - name: Get current version
# id: ver
# run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
# - name: Get app base directory (distroless)
# id: baseDirectoryDistroless
# run: |
# export BASE_DIRECTORY_DISTROLESS=$(sbt "project igluServerDistroless" baseDirectory -Dsbt.log.noformat=true | sed -n '/\[info\]/ s/\[info\] //p' | tail -1 | tr -d '\n')
# echo "::set-output name=directory::$BASE_DIRECTORY_DISTROLESS"
# - name: Stage the Docker build
# run: sbt "project igluServer" docker:stage
# - name: Stage the Docker distroless build
# run: sbt "project igluServerDistroless" docker:stage
# - name: Docker metadata
# id: meta
# uses: docker/metadata-action@v3
# with:
# images: snowplow/iglu-server
# tags: |
# type=raw,value=latest,enable=${{ !contains(steps.ver.outputs.tag, 'rc') }}
# type=raw,value=latest-focal,enable=${{ !contains(steps.ver.outputs.tag, 'rc') }}
# type=raw,value=${{ steps.ver.outputs.tag }}
# type=raw,value=${{ steps.ver.outputs.tag }}-focal
# flavor: |
# latest=false
# - name: Docker metadata distroless
# id: meta-distroless
# uses: docker/metadata-action@v3
# with:
# images: snowplow/iglu-server
# tags: |
# type=raw,value=latest-distroless,enable=${{ !contains(steps.ver.outputs.tag, 'rc') }}
# type=raw,value=${{ steps.ver.outputs.tag }}-distroless
# flavor: |
# latest=false
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v1
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
# - name: Push image
# uses: docker/build-push-action@v2
# with:
# context: target/docker/stage
# platforms: linux/amd64,linux/arm64/v8
# tags: ${{ steps.meta.outputs.tags }}
# push: true
# - name: Push distroless image
# uses: docker/build-push-action@v2
# with:
# context: ${{ steps.baseDirectoryDistroless.outputs.directory }}/target/docker/stage
# platforms: linux/amd64,linux/arm64/v8
# tags: ${{ steps.meta-distroless.outputs.tags }}
# push: true
# - name: Build local distroless image, which is needed to run Snyk
# if: ${{ !contains(steps.ver.outputs.tag, 'rc') }}
# run: sbt "project igluServerDistroless" docker:publishLocal
# - name: Run Snyk to check for vulnerabilities
# uses: snyk/actions/docker@master
# if: ${{ !contains(steps.ver.outputs.tag, 'rc') }}
# with:
# image: "snowplow/iglu-server:${{ steps.ver.outputs.tag }}-distroless"
# args: "--app-vulns --org=data-processing-new"
# command: monitor
# env:
# SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
target/
.bsp/
.idea/

0 comments on commit 1df13c2

Please sign in to comment.