From ea8bfd6a9c5784ae953b67d2e878ccfb09b5ed71 Mon Sep 17 00:00:00 2001 From: Kristoff Kiefer <31993948+kristoff-kiefer@users.noreply.github.com> Date: Mon, 16 Oct 2023 08:40:04 +0200 Subject: [PATCH] Change Github action to only trigger on new tag (#41) * Change Github action to only trigger on new tag * Tag is now put into version of the container. Makes more sense that way, I feel. * Tag is now put into version of the container. Makes more sense that way, I feel. * Tag is now put into version of the container. Makes more sense that way, I feel. --- .github/workflows/image-to-ghcr.yml | 16 ++++++++-------- README.md | 5 +++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/image-to-ghcr.yml b/.github/workflows/image-to-ghcr.yml index c87ccbdfa..ca2198c17 100644 --- a/.github/workflows/image-to-ghcr.yml +++ b/.github/workflows/image-to-ghcr.yml @@ -2,8 +2,8 @@ name: Image to GHCR on: push: - branches-ignore: - - dependabot/** + tags: + - '**' permissions: contents: read @@ -19,13 +19,13 @@ jobs: shell: bash id: extract_branch_meta run: | - echo "lowercase_repo=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT + echo "lowercase_repo=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT if [ "${{ github.event_name }}" == 'pull_request' ]; then echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT - echo "sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT + echo "sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT else - echo "branch=${GITHUB_REF#refs/heads/,,}" >> $GITHUB_OUTPUT - echo "sha=${{ github.sha }}" >> $GITHUB_OUTPUT + echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT + echo "sha=${{ github.sha }}" >> $GITHUB_OUTPUT fi build_and_push: @@ -61,7 +61,7 @@ jobs: - name: Test existence of Image run: | - echo "IMAGE_EXISTS=$(docker manifest inspect ghcr.io/${{ env.LOWERCASE_REPO }}/${{needs.branch_meta.outputs.branch}}:${{ needs.branch_meta.outputs.sha }} > /dev/null && echo 1 || echo 0)" >> $GITHUB_ENV + echo "IMAGE_EXISTS=$(docker manifest inspect ghcr.io/${{ env.LOWERCASE_REPO }}/${{github.ref_name}}:${{ needs.branch_meta.outputs.sha }} > /dev/null && echo 1 || echo 0)" >> $GITHUB_ENV - name: Set up Docker Buildx if: ${{ env.IMAGE_EXISTS == 0 }} @@ -77,7 +77,7 @@ jobs: push: true # temporarily change this to latest to make deployment # tags: ghcr.io/${{ env.LOWERCASE_REPO }}:${{ needs.branch_meta.outputs.sha }} - tags: ghcr.io/${{ env.LOWERCASE_REPO }}/${{needs.branch_meta.outputs.branch}}:latest + tags: ghcr.io/${{ env.LOWERCASE_REPO }}:${{github.ref_name}} labels: ${{ steps.docker_meta_img.outputs.labels }} # trivy-vulnerability-scanning: diff --git a/README.md b/README.md index 18c2b1671..c54d51651 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,11 @@ We have the strategic goal SG-02 "stand-alone system". We want to succeed this g * Test conventions can be found [here](./docs/tests.md) * Configuration conventions can be found [here](./docs/config.md) +## Package (Create Docker Image ) +If you push a tag upstream a container will be created for you. (Check Github under Packages) + +ghcr.io/dbildungsplattform/dbildungs-iam-server:*tag* + ## License The software is licensed under the [AGPL-3.0 license](./LICENSE).