Merge pull request #1442 from alphagov/fix-create_pr-add-build-image-… #1
This file contains 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 images | |
on: | |
workflow_dispatch: | |
inputs: | |
noPushToRegistry: | |
description: Build only, skip pushing to registry | |
required: true | |
type: boolean | |
default: false | |
buildBaseImages: | |
description: Build base images | |
required: true | |
type: boolean | |
default: false | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 3 * * 0' | |
jobs: | |
build_and_push: | |
name: ${{ matrix.app.name }} (${{ matrix.arch }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
app: | |
- name: ckan | |
version: 2.9.9 | |
- name: pycsw | |
version: 2.6.1 | |
- name: postgis | |
version: 13-3.1 | |
- name: solr | |
version: 8 | |
arch: [ amd64 ] | |
permissions: | |
packages: write | |
steps: | |
- name: Login to GHCR | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ inputs.gitRef }} | |
- name: Build images (without pushing to registry) | |
if: ${{ inputs.noPushToRegistry }} | |
env: | |
DRY_RUN: "1" | |
APP: ${{ matrix.app.name }} | |
VERSION: ${{ matrix.app.version }} | |
ARCH: ${{ matrix.arch }} | |
run: ./docker/build-image.sh | |
- name: Build and push images | |
if: ${{ (!inputs.noPushToRegistry && !inputs.buildBaseImages) || (!inputs.noPushToRegistry && inputs.buildBaseImages && (matrix.app.name == 'ckan' || matrix.app.name == 'solr') ) }} | |
env: | |
APP: ${{ matrix.app.name }} | |
VERSION: ${{ matrix.app.version }} | |
ARCH: ${{ matrix.arch }} | |
BUILD_BASE: ${{ inputs.buildBaseImages }} | |
run: ./docker/build-image.sh |