Releases for cnx01: every push to main becomes a signed release
As thukthuk and lampbench-web: once the checks pass on a push to main, the CI job `release` reserves the next CalVer version (YYYY.M.MICRO, Bangkok time) with a draft release, builds the server on Ubuntu 22.04 (glibc 2.35) with that version and the commit (`VISA_COMMIT`), packs bin/visa, VERSION and COMMIT as visa-linux-x86_64.tar.gz, signs it with the repository secret RELEASE_SIGNING_KEY (ssh-keygen, namespace visa-release, principal visa-ci; checked against release/allowed-signers before it is published) and publishes the release. cnx01 will install a release only with that signature (cnx-network-clan modules/visa, in a PR of its own). - .gitea/scripts/release.py and test_release.py from lamp-testbench (the same reserve/publish/discard and version order), with visa's one archive; sign-release.sh; build-release.sh. The release scripts' tests run in the check job. - `visa --version` (and `visa version`): "visa <version> (<commit>)", which CI and cnx01's fetch check. - The key was made locally, put into the secret through the API and deleted; only its public half is in the repo. - README, AGENTS (main is live: push only whole steps), PLAN's decisions. Checks: fmt, clippy; test_release.py 14 tests OK in WSL; `visa --version`.
This commit is contained in:
1 parent
1f54d93643
commit
0d3b2d8b84
10 files changed
+866
-9
No files matched your search
+83
-2
@@ -5,8 +5,18 @@
|
||||
# request trigger covers AGit pull requests, whose commits arrive
|
||||
# without a branch push. The pre-commit hook in .githooks/ scans the
|
||||
# staged changes before they leave a computer.
|
||||
# check: cargo fmt, clippy and the tests against a throwaway PostgreSQL 18,
|
||||
# the version on cnx01 (each #[sqlx::test] creates its own database).
|
||||
# check: cargo fmt, clippy and the tests against a throwaway PostgreSQL 18,
|
||||
# the version on cnx01 (each #[sqlx::test] creates its own
|
||||
# database), and the release scripts' own tests.
|
||||
# release: once both pass on a push to main (or a manual run on main), the
|
||||
# commit becomes the next CalVer release, YYYY.M.MICRO in Bangkok
|
||||
# time (.gitea/scripts/release.py). The server is built for Linux
|
||||
# x86_64 on Ubuntu 22.04 (glibc 2.35; .gitea/scripts/build-release.sh)
|
||||
# and signed with the repository secret RELEASE_SIGNING_KEY
|
||||
# (.gitea/scripts/sign-release.sh). cnx01 installs each release
|
||||
# with that signature only, within 15 minutes, and restarts the app
|
||||
# on it (cnx-network-clan modules/visa): a push to main is a deploy.
|
||||
# A commit message with [skip ci] skips the whole workflow.
|
||||
name: CI
|
||||
|
||||
on:
|
||||
@@ -58,6 +68,15 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Release script tests
|
||||
run: |
|
||||
if ! command -v python3 >/dev/null || ! command -v ssh-keygen >/dev/null; then
|
||||
SUDO=$(command -v sudo || true)
|
||||
$SUDO apt-get update -qq
|
||||
$SUDO apt-get install -y -qq python3 openssh-client
|
||||
fi
|
||||
python3 .gitea/scripts/test_release.py
|
||||
|
||||
- name: Rust toolchain
|
||||
run: bash .gitea/scripts/rust-toolchain.sh "$RUST_TOOLCHAIN"
|
||||
|
||||
@@ -79,3 +98,65 @@ jobs:
|
||||
|
||||
- name: Tests
|
||||
run: cargo test --locked
|
||||
|
||||
release:
|
||||
name: release
|
||||
needs: [leaks, check]
|
||||
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 60
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: System packages
|
||||
run: |
|
||||
SUDO=$(command -v sudo || true)
|
||||
$SUDO apt-get update -qq
|
||||
$SUDO apt-get install -y -qq python3 openssh-client
|
||||
|
||||
# Holds the next version with a draft release on this commit; empty when
|
||||
# a newer release already contains the commit.
|
||||
- name: Version
|
||||
id: version
|
||||
run: python3 .gitea/scripts/release.py reserve
|
||||
|
||||
- name: Rust toolchain
|
||||
if: steps.version.outputs.version != ''
|
||||
run: bash .gitea/scripts/rust-toolchain.sh "$RUST_TOOLCHAIN"
|
||||
|
||||
- uses: actions/cache@v4
|
||||
if: steps.version.outputs.version != ''
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry/index
|
||||
~/.cargo/registry/cache
|
||||
~/.cargo/git/db
|
||||
target
|
||||
key: release-${{ runner.os }}-${{ env.RUST_TOOLCHAIN }}-${{ hashFiles('Cargo.lock') }}
|
||||
restore-keys: release-${{ runner.os }}-${{ env.RUST_TOOLCHAIN }}-
|
||||
|
||||
- name: Build
|
||||
if: steps.version.outputs.version != ''
|
||||
run: bash .gitea/scripts/build-release.sh "${{ steps.version.outputs.version }}"
|
||||
|
||||
# cnx01 installs the server only with this signature
|
||||
- name: Sign
|
||||
if: steps.version.outputs.version != ''
|
||||
env:
|
||||
RELEASE_SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
|
||||
run: bash .gitea/scripts/sign-release.sh dist/visa-linux-x86_64.tar.gz
|
||||
|
||||
- name: Publish
|
||||
if: steps.version.outputs.version != ''
|
||||
run: python3 .gitea/scripts/release.py publish "${{ steps.version.outputs.release_id }}" dist/*
|
||||
|
||||
- name: Discard the draft
|
||||
if: (failure() || cancelled()) && steps.version.outputs.release_id != ''
|
||||
run: python3 .gitea/scripts/release.py discard "${{ steps.version.outputs.release_id }}"
|
||||
Reference in new issue
Block a user