Publish Container Images #8
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: Publish Container Images | |
| run-name: Publish Container ${{ inputs.tag || github.event.release.tag_name }} Images | |
| on: | |
| release: | |
| types: [published, edited] | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| ref: | |
| description: 'Optional - The branch, tag or SHA to checkout.' | |
| required: false | |
| type: string | |
| platforms: | |
| description: 'Platforms - Comma separated list of the platforms to support.' | |
| required: true | |
| default: linux/amd64 | |
| type: string | |
| workflow_call: | |
| inputs: | |
| ref: | |
| required: false | |
| type: string | |
| platforms: | |
| required: true | |
| default: linux/amd64 | |
| type: string | |
| # Ensure only the most recent workflow runs. | |
| concurrency: | |
| group: von-network | |
| cancel-in-progress: true | |
| jobs: | |
| publish-image: | |
| # Ensure this only runs on the main repository so we're not publishing images to other repositories. | |
| if: ${{ github.event.repository.full_name == 'bcgov/von-network' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| imageName: [von-network-base] | |
| include: | |
| - imageName: von-network-base | |
| dockerFile: Dockerfile | |
| context: . | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| - name: Lowercase repo owner | |
| id: lowercase_repo_owner | |
| uses: ASzc/change-string-case-action@v6 | |
| with: | |
| string: ${{ github.repository_owner }} | |
| - name: Build and publish the image | |
| uses: ./.github/actions/publish-image | |
| with: | |
| ref: ${{ inputs.ref || '' }} | |
| registry: ghcr.io | |
| registry_username: ${{ github.actor }} | |
| registry_password: ${{ secrets.GITHUB_TOKEN }} | |
| dockerfile: ${{ matrix.dockerFile }} | |
| context: ${{ matrix.context }} | |
| image_name: ${{ steps.lowercase_repo_owner.outputs.lowercase }}/${{ matrix.imageName }} | |
| platforms: ${{ inputs.platforms || 'linux/amd64' }} |