Skip to content

Beta CI

Beta CI #87365

Workflow file for this run

name: Beta CI
on:
schedule:
- cron: "33 */2 * * *"
env:
NAME: rust
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- alpine3.20
- alpine3.19
- bookworm
- bookworm-slim
- bullseye
- bullseye-slim
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check upstream version changed
id: upstream
run: |
result=$(bash beta/check-changed.sh 2>&1)
echo "$result"
echo 'result<<EOF'$'\n'"$result"$'\n'EOF >> $GITHUB_OUTPUT
env:
IMAGE: ghcr.io/${{ github.repository_owner }}/${{ env.NAME }}
IMAGE_OS: ${{ matrix.os }}
- uses: docker/setup-buildx-action@v3
if: ${{ contains(steps.upstream.outputs.result, 'CHANGED') }}
- name: Build image
run: docker build --network=host --force-rm --no-cache --pull
--label org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
-t ${{ github.repository_owner }}/${{ env.NAME }}:build-${{ matrix.os }}
./beta/${{ matrix.os }}/
if: ${{ contains(steps.upstream.outputs.result, 'CHANGED') }}
- name: Tar image
run: docker save -o image.tar
${{ github.repository_owner }}/${{ env.NAME }}:build-${{ matrix.os }}
if: ${{ contains(steps.upstream.outputs.result, 'CHANGED') }}
# TODO: Migrate to v4 once `xSAVIKx/artifact-exists-action` supports it:
# https://github.com/xSAVIKx/artifact-exists-action/tree/v0.6#artifact-exists-action
- uses: actions/upload-artifact@v3
with:
name: build-${{ matrix.os }}-${{ github.run_number }}
path: image.tar
retention-days: 1
if: ${{ contains(steps.upstream.outputs.result, 'CHANGED') }}
push:
needs: ["build"]
strategy:
fail-fast: false
matrix:
registry: ["ghcr.io", "docker.io", "quay.io"]
os:
- alpine3.20
- alpine3.19
- bookworm
- bookworm-slim
- bullseye
- bullseye-slim
include:
- os: alpine3.20
tags: |
<full-ver>-alpine3.20
<full-ver>-alpine
<num-ver>-beta-alpine3.20
<num-ver>-beta-alpine
beta-alpine3.20
beta-alpine
- os: alpine3.19
tags: |
<full-ver>-alpine3.19
<num-ver>-beta-alpine3.19
beta-alpine3.19
- os: bookworm
tags: |
<full-ver>-bookworm
<full-ver>
<num-ver>-beta-bookworm
<num-ver>-beta
beta-bookworm
beta
- os: bookworm-slim
tags: |
<full-ver>-bookworm-slim
<full-ver>-slim
<num-ver>-beta-bookworm-slim
<num-ver>-beta-slim
beta-bookworm-slim
beta-slim
- os: bullseye
tags: |
<full-ver>-bullseye
<num-ver>-beta-bullseye
beta-bullseye
- os: bullseye-slim
tags: |
<full-ver>-bullseye-slim
<num-ver>-beta-bullseye-slim
beta-bullseye-slim
runs-on: ubuntu-latest
steps:
# Skip if this is fork and no credentials are provided.
- id: skip
run: echo "no=${{ !(
github.repository_owner != 'instrumentisto'
&& ((matrix.registry == 'quay.io'
&& secrets.QUAYIO_ROBOT_USER == '')
|| (matrix.registry == 'docker.io'
&& secrets.DOCKERHUB_BOT_USER == ''))
) }}" >> $GITHUB_OUTPUT
- name: Check new image was built
id: artifact
uses: xSAVIKx/[email protected]
with:
name: build-${{ matrix.os }}-${{ github.run_number }}
- uses: actions/checkout@v4
if: ${{ steps.skip.outputs.no == 'true'
&& steps.artifact.outputs.exists == 'true' }}
# TODO: Migrate to v4 once `xSAVIKx/artifact-exists-action` supports it:
# https://github.com/xSAVIKx/artifact-exists-action/tree/v0.6#artifact-exists-action
- uses: actions/download-artifact@v3
with:
name: build-${{ matrix.os }}-${{ github.run_number }}
if: ${{ steps.skip.outputs.no == 'true'
&& steps.artifact.outputs.exists == 'true' }}
- name: Untar image
run: docker load -i image.tar
if: ${{ steps.skip.outputs.no == 'true'
&& steps.artifact.outputs.exists == 'true' }}
- name: Login to ${{ matrix.registry }} container registry
uses: docker/login-action@v3
with:
registry: ${{ matrix.registry }}
username: ${{ (matrix.registry == 'docker.io'
&& secrets.DOCKERHUB_BOT_USER)
|| (matrix.registry == 'quay.io'
&& secrets.QUAYIO_ROBOT_USER)
|| github.repository_owner }}
password: ${{ (matrix.registry == 'docker.io'
&& secrets.DOCKERHUB_BOT_PASS)
|| (matrix.registry == 'quay.io'
&& secrets.QUAYIO_ROBOT_TOKEN)
|| secrets.GITHUB_TOKEN }}
if: ${{ steps.skip.outputs.no == 'true'
&& steps.artifact.outputs.exists == 'true' }}
- name: Push image
run: bash beta/push.sh
env:
IMAGE_FROM: ${{ github.repository_owner }}/${{ env.NAME }}:build-${{ matrix.os }}
IMAGE: ${{ matrix.registry }}/${{ github.repository_owner }}/${{ env.NAME }}
IMAGE_TAGS: ${{ matrix.tags }}
if: ${{ steps.skip.outputs.no == 'true'
&& steps.artifact.outputs.exists == 'true' }}