Skip to content

Nightly Publish

Nightly Publish #1004

Workflow file for this run

name: Nightly Publish
permissions:
contents: read
packages: write
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
schedule:
- cron: '0 6 * * *'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
#VERSIONS
- name: bullseye
context: nightly/bullseye
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386
tags: |
nightly-bullseye
- name: slim-bullseye
context: nightly/bullseye/slim
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386
tags: |
nightly-bullseye-slim
- name: bookworm
context: nightly/bookworm
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x
tags: |
nightly-bookworm
- name: slim-bookworm
context: nightly/bookworm/slim
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x
tags: |
nightly-bookworm-slim
- name: trixie
context: nightly/trixie
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x,linux/riscv64
tags: |
nightly-trixie
nightly
- name: slim-trixie
context: nightly/trixie/slim
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x,linux/riscv64
tags: |
nightly-trixie-slim
nightly-slim
- name: alpine3.21
context: nightly/alpine3.21
platforms: linux/amd64,linux/arm64,linux/ppc64le
tags: |
nightly-alpine3.21
- name: alpine3.22
context: nightly/alpine3.22
platforms: linux/amd64,linux/arm64,linux/ppc64le
tags: |
nightly-alpine3.22
- name: alpine3.23
context: nightly/alpine3.23
platforms: linux/amd64,linux/arm64,linux/ppc64le
tags: |
nightly-alpine3.23
nightly-alpine
#VERSIONS
name: ${{ matrix.name }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up QEMU
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Login to GHCR
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master'
with:
registry: ghcr.io
username: rust-lang
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master'
with:
username: rustopsbot
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Compute nightly date
id: date
env:
EVENT_NAME: ${{ github.event_name }}
run: |
set -euo pipefail
DATE=$(date -u +%Y-%m-%d)
URL="https://static.rust-lang.org/dist/${DATE}/channel-rust-nightly.toml"
if ! curl -fsI -o /dev/null "$URL"; then
case "${EVENT_NAME}" in
push|pull_request)
echo "Today's nightly manifest is not yet published; falling back to yesterday." >&2
DATE=$(date -u -d 'yesterday' +%Y-%m-%d)
;;
*)
echo "Today's nightly manifest is not yet published; refusing to publish a stale nightly." >&2
exit 1
;;
esac
fi
echo "date=${DATE}" >> "$GITHUB_OUTPUT"
- name: Build dated tag list
id: dated_tags
env:
BASE_TAGS: ${{ matrix.tags }}
DATE: ${{ steps.date.outputs.date }}
run: |
{
echo "tags<<EOF"
while IFS= read -r tag; do
[ -z "$tag" ] && continue
echo "type=raw,value=${tag}-${DATE}"
done <<< "$BASE_TAGS"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Docker Metadata
id: meta
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
with:
images: |
rustlang/rust
ghcr.io/rust-lang/rust
tags: |
${{ matrix.tags }}
${{ steps.dated_tags.outputs.tags }}
- name: Build and push image
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: ${{ matrix.context }}
platforms: ${{ matrix.platforms }}
build-args: |
RUST_VERSION=nightly-${{ steps.date.outputs.date }}
push: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}