Merge pull request #5 from OpenTechIL/develop #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push to GHCR | |
| on: | |
| push: | |
| branches: | |
| - release | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # Ensure lowercase to avoid registry errors | |
| - name: Set lower case repo name | |
| run: | | |
| echo "IMAGE_NAME=ghcr.io/${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} | |
| - name: Bump version and push tag | |
| id: tagger | |
| uses: mathieudutour/github-tag-action@v6.2 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| tag_prefix: "v" | |
| - name: Log in to GHCR | |
| uses: redhat-actions/podman-login@v1 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build Image | |
| id: build_image | |
| uses: redhat-actions/buildah-build@v2 | |
| with: | |
| # Use the full name in tags to satisfy both build and push actions | |
| tags: | | |
| ${{ env.IMAGE_NAME }}:${{ steps.tagger.outputs.new_tag }} | |
| ${{ env.IMAGE_NAME }}:latest | |
| context: . | |
| containerfiles: ./Dockerfile | |
| - name: Push to GHCR | |
| uses: redhat-actions/push-to-registry@v2 | |
| with: | |
| # Providing tags from the previous step is sufficient | |
| # when they are "fully qualified" (contain the registry URL) | |
| tags: ${{ steps.build_image.outputs.tags }} |