Skip to content

Commit

Permalink
Change Github action to only trigger on new tag (#41)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
kristoff-kiefer authored Oct 16, 2023
1 parent 309b2b9 commit ea8bfd6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/image-to-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Image to GHCR

on:
push:
branches-ignore:
- dependabot/**
tags:
- '**'

permissions:
contents: read
Expand All @@ -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:
Expand Down Expand Up @@ -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 }}
Expand All @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

0 comments on commit ea8bfd6

Please sign in to comment.