Skip to content
87 linesCodeBlameRaw
1# Releases the g1t CLI (crates/g1t): builds it for Linux and macOS on x64
2# and arm64 and for Windows on x64, signs the release, and publishes it to
3# g1t.sh/downloads/cli/ (the g1t-downloads R2 bucket), where g1t.sh/install
4# and g1t.sh/install.ps1 find it.
5#
6# A release is a tag `cli-v<version>`, where the version is the one in
7# crates/g1t/Cargo.toml; or run it by hand. scripts/cli-release.mjs does the
8# work, and its header says what a release holds. It is signed with the
9# runner's release key (RUNNER_RELEASE_KEY, RUNNER_RELEASE_PUBLIC_KEY).
10#
11# Every platform builds in one job, in the rust-cross/cargo-zigbuild image:
12# the macOS builds link Apple's Security framework (the keychain), and that
13# image carries its SDK. It runs on g1t's own machines (g1t-4core), whose
14# jobs have a Docker Engine of their own.
15name: CLI release
16
17on:
18 push:
19 tags: ["cli-v*"]
20 workflow_dispatch:
21
22permissions:
23 contents: read
24
25concurrency:
26 group: cli-release
27 cancel-in-progress: false
28
29env:
30 CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
31 WRANGLER_SEND_METRICS: "false"
32
33jobs:
34 build:
35 name: Build every platform
36 runs-on: g1t-4core
37 timeout-minutes: 60
38 steps:
39 - uses: actions/checkout@v5
40 - name: The tag names this version
41 if: startsWith(github.ref, 'refs/tags/cli-v')
42 run: |
43 version="$(sed -n 's/^version = "\(.*\)"/\1/p' crates/g1t/Cargo.toml | head -1)"
44 [ "cli-v$version" = "${GITHUB_REF_NAME}" ] || { echo "::error::The tag is ${GITHUB_REF_NAME}, but crates/g1t is $version"; exit 1; }
45 - name: Build
46 run: node scripts/cli-release.mjs build
47 - uses: actions/upload-artifact@v4
48 with:
49 name: cli
50 path: target/cli-release/
51 overwrite: true
52
53 publish:
54 name: Sign and publish
55 needs: build
56 runs-on: ubuntu-latest
57 # Production's secrets, without a deployment: a release is not a deploy
58 # of g1t.sh.
59 environment:
60 name: production
61 deployment: false
62 timeout-minutes: 30
63 steps:
64 - uses: actions/checkout@v5
65 - uses: actions/download-artifact@v4
66 with:
67 name: cli
68 path: target/cli-release
69 - name: Sign
70 env:
71 RUNNER_RELEASE_KEY: ${{ secrets.RUNNER_RELEASE_KEY }}
72 G1T_RUNNER_RELEASE_KEY: ${{ vars.RUNNER_RELEASE_PUBLIC_KEY }}
73 run: |
74 node scripts/cli-release.mjs sign
75 node scripts/cli-release.mjs verify
76 - name: Cache npm's downloads
77 uses: actions/cache@v4
78 with:
79 path: ~/.npm
80 key: npm-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
81 restore-keys: npm-${{ runner.os }}-
82 - name: Install Wrangler
83 run: npm ci --prefer-offline --workspaces=false --no-audit --no-fund
84 - name: Publish to g1t.sh/downloads/cli
85 env:
86 CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
87 run: node scripts/cli-release.mjs publish