Skip to content

Docker Nightly Builder #1490

Docker Nightly Builder

Docker Nightly Builder #1490

---
name: Docker Nightly Builder
"on":
push:
branches:
- trunk
pull_request:
branches:
- trunk
schedule:
- cron: "0 0 * * *" # build nightly!
jobs:
nightly:
name: Nightly
runs-on: ubuntu-latest
strategy:
matrix:
build:
- alpine
- debian
- ubuntu
include:
- build: alpine
target_triple: x86_64-unknown-linux-musl
dockerfile: alpine/Dockerfile
docker_target_platforms: linux/amd64
tag_bare: alpine
tag_version: alpine3
- build: debian
target_triple: x86_64-unknown-linux-gnu
dockerfile: debian/bullseye/slim/Dockerfile
docker_target_platforms: linux/amd64,linux/arm64
tag_bare: slim
tag_version: slim-bullseye
- build: ubuntu
target_triple: x86_64-unknown-linux-gnu
dockerfile: ubuntu/jammy/Dockerfile
docker_target_platforms: linux/amd64,linux/arm64
tag_bare: ubuntu
tag_version: ubuntu-jammy
steps:
- uses: actions/[email protected]
- name: Clone Artichoke
uses: actions/[email protected]
with:
repository: artichoke/artichoke
path: artichoke
- name: Set Artichoke latest commit
id: latest
working-directory: artichoke
run: |
echo "Artichoke git ref: $(git rev-parse HEAD)"
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Setup Python
uses: actions/[email protected]
with:
python-version: "3.11"
- name: Set Artichoke Rust toolchain version
id: rust_toolchain
working-directory: artichoke
shell: python
run: |
import os
import tomllib
with open("rust-toolchain.toml", "rb") as f:
data = tomllib.load(f)
toolchain = data["toolchain"]["channel"]
print(f"Rust toolchain version: {toolchain}")
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
print(f"version={toolchain}", file=f)
- name: Set labels
id: labels
working-directory: artichoke
shell: python
run: |
import datetime
import os
import tomllib
with open("Cargo.toml", "rb") as f:
data = tomllib.load(f)
version = data["package"]["version"]
version = f"{version}-nightly"
print(f"Artichoke version: {version}")
current_time = datetime.datetime.now(datetime.timezone.utc)
build_timestamp = current_time.isoformat()
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
print(f"artichoke_version={version}", file=f)
print(f"build_timestamp={build_timestamp}", file=f)
- name: Generate THIRDPARTY license listing
uses: artichoke/[email protected]
with:
artichoke_ref: ${{ steps.latest.outputs.commit }}
target_triple: ${{ matrix.target_triple }}
output_file: ${{ github.workspace }}/THIRDPARTY
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Login to DockerHub
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
if: github.ref == 'refs/heads/trunk'
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
platforms: ${{ matrix.docker_target_platforms }}
file: ${{ matrix.dockerfile }}
push: ${{ github.ref == 'refs/heads/trunk' }}
tags: |
artichokeruby/artichoke:${{ matrix.tag_bare }}-nightly
artichokeruby/artichoke:${{ matrix.tag_version }}-nightly
build-args: |
ARTICHOKE_NIGHTLY_REVISION=${{ steps.latest.outputs.commit }}
ARTICHOKE_NIGHTLY_VERSION=${{ steps.labels.outputs.artichoke_version }}
BUILD_TIMESTAMP=${{ steps.labels.outputs.build_timestamp }}
RUST_VERSION=${{ steps.rust_toolchain.outputs.version }}
- name: Build and push Docker images (Ubuntu extra tags)
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
if: matrix.build == 'ubuntu'
with:
context: .
platforms: ${{ matrix.docker_target_platforms }}
file: ${{ matrix.dockerfile }}
push: ${{ github.ref == 'refs/heads/trunk' }}
tags: |
artichokeruby/artichoke:latest
artichokeruby/artichoke:ubuntu22.04-nightly
build-args: |
ARTICHOKE_NIGHTLY_REVISION=${{ steps.latest.outputs.commit }}
ARTICHOKE_NIGHTLY_VERSION=${{ steps.labels.outputs.artichoke_version }}
BUILD_TIMESTAMP=${{ steps.labels.outputs.build_timestamp }}
RUST_VERSION=${{ steps.rust_toolchain.outputs.version }}