Files
alchemist/.github/workflows/nightly.yml
2026-04-04 14:29:32 -04:00

122 lines
3.4 KiB
YAML

name: Nightly
on:
push:
branches:
- master
workflow_dispatch:
concurrency:
group: nightly-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
packages: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
ci-gate:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_SIZE: 2G
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: rust-linux-shared
- name: Check formatting
run: cargo fmt --all -- --check
- name: Lint
run: cargo clippy --locked --all-targets --all-features -- -D warnings -D clippy::unwrap_used -D clippy::expect_used
- name: Check
run: cargo check --locked --all-targets --all-features
compute-meta:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
short_sha: ${{ steps.meta.outputs.short_sha }}
version_suffix: ${{ steps.meta.outputs.version_suffix }}
release_tag: ${{ steps.meta.outputs.release_tag }}
release_name: ${{ steps.meta.outputs.release_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Compute metadata
id: meta
shell: bash
run: |
set -euo pipefail
SHORT_SHA=$(git rev-parse --short=7 "${GITHUB_SHA}")
TAG_STAMP=$(date -u +%Y%m%d-%H%M%S)
DISPLAY_STAMP=$(date -u +"%Y-%m-%d %H:%M UTC")
RELEASE_TAG="nightly-${TAG_STAMP}-${SHORT_SHA}"
{
echo "short_sha=${SHORT_SHA}"
echo "version_suffix=nightly+${SHORT_SHA}"
echo "release_tag=${RELEASE_TAG}"
echo "release_name=Nightly — ${SHORT_SHA} (${DISPLAY_STAMP})"
} >> "$GITHUB_OUTPUT"
publish-nightly-tags:
needs: [ci-gate, compute-meta]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Publish nightly tags
env:
RELEASE_TAG: ${{ needs.compute-meta.outputs.release_tag }}
shell: bash
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email \
"41898282+github-actions[bot]@users.noreply.github.com"
git tag "${RELEASE_TAG}" "${GITHUB_SHA}"
git tag -f nightly "${GITHUB_SHA}"
git push origin "refs/tags/${RELEASE_TAG}"
git push origin refs/tags/nightly --force
build:
needs: [ci-gate, compute-meta, publish-nightly-tags]
uses: ./.github/workflows/build.yml
with:
version_suffix: ${{ needs.compute-meta.outputs.version_suffix }}
push_docker: true
docker_tags: ghcr.io/bybrooklyn/alchemist:nightly
publish_release: true
release_tag: ${{ needs.compute-meta.outputs.release_tag }}
release_name: ${{ needs.compute-meta.outputs.release_name }}
prerelease: true
make_latest: false