Build and push images #552
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: | |
gitRef: | |
description: Commit, tag or branch name to deploy | |
required: true | |
type: string | |
default: main | |
noPushToRegistry: | |
description: Build only, skip pushing to registry | |
required: true | |
type: boolean | |
default: false | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 3 * * *' | |
jobs: | |
build_and_push: | |
name: Build ruby_${{ matrix.version }} images and push to GHCR | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
version: ['3_1', '3_1_2', '3_2', '3_2_0'] | |
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" | |
run: ./build.sh ${{ matrix.version }} | |
- name: Build and push images | |
if: ${{ !inputs.noPushToRegistry }} | |
run: ./build.sh ${{ matrix.version }} |