Build all images on pull requests #1
Workflow file for this run
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: main | |
on: | |
pull_request: | |
env: | |
go-version: 1.23 | |
jobs: | |
build: | |
name: Build images | |
strategy: | |
matrix: | |
ubuntu-version: ["20.04", "22.04", "24.04"] | |
runs-on: ubuntu-24.04 | |
defaults: | |
run: | |
working-directory: ${{ matrix.ubuntu-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64/v8 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: v0.17.1 | |
- name: Setup golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.go-version }} | |
- name: Build images | |
if: github.event_name != 'pull_request' | |
run: | | |
TAG_MINIMAL=$(cat TAG_MINIMAL) | |
TAG=$(cat TAG) | |
BRANCH=$(cat BRANCH) | |
for image in ubuntu-minimal ubuntu ubuntu-dev ubuntu-debug; do | |
echo | |
echo "building $image ..." | |
docker buildx build \ | |
--platform linux/amd64,linux/arm64/v8 \ | |
-t ghcr.io/cybozu/${image}:$TAG \ | |
-t ghcr.io/cybozu/${image}:$BRANCH \ | |
--build-arg TAG_MINIMAL=$TAG_MINIMAL \ | |
--build-arg TAG=$TAG \ | |
${image} | |
done |