Dispatch workflow via push event #1
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 Container Images | |
| on: | |
| schedule: | |
| - cron: '33 4 * * 0' | |
| push: | |
| branches: | |
| - master | |
| - core24_support | |
| workflow_dispatch: | |
| env: | |
| # Use docker.io for Docker Hub if empty | |
| REGISTRY: ghcr.io | |
| # github.repository as <account>/<repo> | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| build-image: | |
| runs-on: ubuntu-latest | |
| name: Build ${{ matrix.cfg.base }} Image | |
| strategy: | |
| matrix: | |
| cfg: | |
| - base: core | |
| base_os: xenial | |
| platforms: linux/arm64,linux/arm/v7 | |
| - base: core18 | |
| base_os: bionic | |
| platforms: linux/arm64,linux/arm/v7 | |
| - base: core20 | |
| base_os: focal | |
| platforms: linux/arm64,linux/arm/v7 | |
| - base: core22 | |
| base_os: jammy | |
| platforms: linux/arm64,linux/arm/v7 | |
| - base: core24 | |
| base_os: noble | |
| platforms: linux/arm64,linux/arm/v7 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=branch,prefix=${{ matrix.cfg.base }}- | |
| type=ref,event=pr,prefix=${{ matrix.cfg.base }}- | |
| type=semver,pattern={{version}},prefix=${{ matrix.cfg.base }}- | |
| type=semver,pattern={{major}}.{{minor}},prefix=${{ matrix.cfg.base }}- | |
| type=sha,prefix=${{ matrix.cfg.base }}- | |
| type=raw,value=${{ matrix.cfg.base }} | |
| labels: | | |
| org.opencontainers.image.title=Snapcraft for ${{ matrix.cfg.base }} builds | |
| org.opencontainers.image.description=Image of Snapcraft for building projects targeting the ${{ matrix.cfg.base }} base snap. | |
| org.opencontainers.image.authors=massimiliano.girardi@canonical.com | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| # see https://github.com/tonistiigi/binfmt/issues/215 | |
| # also see: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2096782 | |
| image: ${{ matrix.cfg.base_os != 'jammy' && 'tonistiigi/binfmt:master' || 'tonistiigi/binfmt:qemu-v7.0.0-28' }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to ghio | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: ${{ matrix.cfg.platforms }} | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| BASE_OS=${{ matrix.cfg.base_os }} |