ci: combine individual jobs to one pipeline
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
name: Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ['*.*.*']
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '0 7 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
SITE_SLUG: coursebank
|
||||
CRATE: coursebank
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: pixi-build-rust
|
||||
env:
|
||||
CARGO_TARGET_DIR: /opt/cargo-target/${{ gitea.repository }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install the pinned toolchain
|
||||
run: pixi install
|
||||
|
||||
- name: Verify (formatting, lint, tests, docs)
|
||||
run: pixi run check
|
||||
|
||||
nightly:
|
||||
needs: check
|
||||
if: ${{ (gitea.event_name == 'push' && gitea.ref == 'refs/heads/main') || gitea.event_name == 'schedule' || gitea.event_name == 'workflow_dispatch' }}
|
||||
runs-on: pixi-build-rust
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Install the pinned toolchain
|
||||
run: pixi install
|
||||
|
||||
- name: Build the release binary
|
||||
run: |
|
||||
COURSEBANK_VERSION="$(bash scripts/nightly-version.sh)"
|
||||
export COURSEBANK_VERSION
|
||||
echo "nightly version: ${COURSEBANK_VERSION}"
|
||||
pixi run build
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
mkdir -p stage
|
||||
cp target/release/coursebank LICENSE.md stage/
|
||||
bash scripts/package.sh coursebank-nightly-linux-x64.tar.gz stage
|
||||
|
||||
- name: Publish the rolling nightly prerelease
|
||||
env:
|
||||
GITEA_API: ${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
JQ: pixi exec --spec jq -- jq
|
||||
TAG: nightly
|
||||
PRERELEASE: "true"
|
||||
REPLACE: "true"
|
||||
TARGET_COMMITISH: ${{ gitea.sha }}
|
||||
ASSETS: coursebank-nightly-linux-x64.tar.gz coursebank-nightly-linux-x64.tar.gz.sha256
|
||||
run: |
|
||||
ver="$(bash scripts/nightly-version.sh)"
|
||||
export RELEASE_NAME="Nightly ${ver}"
|
||||
export BODY="Nightly build ${ver}, built $(date -u +%Y-%m-%d). Not a stable release."
|
||||
bash scripts/gitea-release.sh
|
||||
|
||||
release:
|
||||
needs: check
|
||||
if: ${{ gitea.event_name == 'push' && startsWith(gitea.ref, 'refs/tags/') }}
|
||||
runs-on: pixi-build-rust
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check the tag matches the crate version
|
||||
env:
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
run: bash scripts/check-tag-version.sh
|
||||
|
||||
- name: Install the pinned toolchain
|
||||
run: pixi install
|
||||
|
||||
- name: Build the full bundle (binary and license notices)
|
||||
run: |
|
||||
pixi run setup-tools
|
||||
pixi run dist
|
||||
|
||||
- name: Package
|
||||
run: bash scripts/package.sh "coursebank-$(bash scripts/version.sh)-linux-x64.tar.gz" dist
|
||||
|
||||
- name: Publish the release
|
||||
env:
|
||||
GITEA_API: ${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
JQ: pixi exec --spec jq -- jq
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
BODY: See CHANGELOG.md.
|
||||
run: |
|
||||
asset="coursebank-$(bash scripts/version.sh)-linux-x64.tar.gz"
|
||||
export ASSETS="$asset $asset.sha256"
|
||||
bash scripts/gitea-release.sh
|
||||
|
||||
docs:
|
||||
needs: check
|
||||
if: ${{ (gitea.event_name == 'push' && (gitea.ref == 'refs/heads/main' || startsWith(gitea.ref, 'refs/tags/'))) || gitea.event_name == 'workflow_dispatch' }}
|
||||
runs-on: pixi-build-rust
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build the API docs
|
||||
env:
|
||||
RUSTDOCFLAGS: "--html-before-content ${{ gitea.workspace }}/scripts/docs-banner.html"
|
||||
run: |
|
||||
pixi install --locked
|
||||
pixi run doc-build
|
||||
|
||||
- name: Redirect the channel root to the crate page
|
||||
run: |
|
||||
printf '%s\n' "<!doctype html><meta http-equiv=\"refresh\" content=\"0; url=${CRATE}/\">" > target/doc/index.html
|
||||
|
||||
- name: Publish the channel to /srv/www
|
||||
run: |
|
||||
case "${{ gitea.ref }}" in
|
||||
refs/tags/*) channel=release ;;
|
||||
*) channel=nightly ;;
|
||||
esac
|
||||
bash scripts/publish-docs.sh "$channel"
|
||||
|
||||
- name: Point the site root at the latest release, else nightly
|
||||
run: bash scripts/docs-default-redirect.sh
|
||||
Reference in New Issue
Block a user