From 22854842ca4b0812a1a0549339254d5d6267f6da Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Fri, 24 Jan 2025 08:08:01 +0200 Subject: [PATCH 1/2] Create release-image.yml Fix #56 --- .github/workflows/release-image.yml | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/release-image.yml diff --git a/.github/workflows/release-image.yml b/.github/workflows/release-image.yml new file mode 100644 index 0000000..5644022 --- /dev/null +++ b/.github/workflows/release-image.yml @@ -0,0 +1,52 @@ +name: Release image to DockerHub + +on: + workflow_dispatch: + push: + tags: ["v*.*.*"] + branches: + - main + +jobs: + build-and-release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set tags + run: | + if ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}; then + echo "TAGS=falkordb/code-graph-backend:latest,falkordb/code-graph-backend:${{ github.ref_name }}" >> $GITHUB_ENV + else + echo "TAGS=falkordb/code-graph-backend:edge" >> $GITHUB_ENV + fi + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: false + tags: ${{ env.TAGS }} + + - name: Scan image for vulnerabilities + uses: aquasecurity/trivy-action@master + with: + image-ref: ${{ env.TAGS }} + format: 'table' + exit-code: '1' + severity: 'CRITICAL,HIGH' + + - name: Push image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ env.TAGS }} From 588af7bc9b463a596d3b6469ab5f509ffc2c1ace Mon Sep 17 00:00:00 2001 From: Guy Korland Date: Fri, 24 Jan 2025 08:11:38 +0200 Subject: [PATCH 2/2] Update Trivy action to version 0.29.0 --- .github/workflows/release-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-image.yml b/.github/workflows/release-image.yml index 5644022..1d58779 100644 --- a/.github/workflows/release-image.yml +++ b/.github/workflows/release-image.yml @@ -37,7 +37,7 @@ jobs: tags: ${{ env.TAGS }} - name: Scan image for vulnerabilities - uses: aquasecurity/trivy-action@master + uses: aquasecurity/trivy-action@0.29.0 with: image-ref: ${{ env.TAGS }} format: 'table'