| 1 |
name: Release |
| 2 |
|
| 3 |
on: |
| 4 |
release: |
| 5 |
types: [published] |
| 6 |
|
| 7 |
permissions: read-all |
| 8 |
|
| 9 |
env: |
| 10 |
CARGO_INCREMENTAL: 0 |
| 11 |
|
| 12 |
jobs: |
| 13 |
build-release: |
| 14 |
name: build-release |
| 15 |
permissions: |
| 16 |
contents: write |
| 17 |
strategy: |
| 18 |
fail-fast: false |
| 19 |
matrix: |
| 20 |
build: [linux-x86_64-musl, linux-aarch64-musl, macos-x86_64, macos-aarch64, win-x86_64, win-aarch64] |
| 21 |
include: |
| 22 |
- build: linux-x86_64-musl |
| 23 |
os: ubuntu-24.04 |
| 24 |
target: x86_64-unknown-linux-musl |
| 25 |
- build: linux-aarch64-musl |
| 26 |
os: ubuntu-24.04-arm |
| 27 |
target: aarch64-unknown-linux-musl |
| 28 |
- build: macos-x86_64 |
| 29 |
os: macos-15 |
| 30 |
target: x86_64-apple-darwin |
| 31 |
- build: macos-aarch64 |
| 32 |
os: macos-15 |
| 33 |
target: aarch64-apple-darwin |
| 34 |
- build: win-x86_64 |
| 35 |
os: windows-2022 |
| 36 |
target: x86_64-pc-windows-msvc |
| 37 |
- build: win-aarch64 |
| 38 |
os: windows-11-arm |
| 39 |
target: aarch64-pc-windows-msvc |
| 40 |
runs-on: ${{ matrix.os }} |
| 41 |
steps: |
| 42 |
- name: Checkout repository |
| 43 |
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 |
| 44 |
with: |
| 45 |
persist-credentials: false |
| 46 |
- name: Install packages (Ubuntu) |
| 47 |
if: startsWith(matrix.os, 'ubuntu') |
| 48 |
run: | |
| 49 |
sudo apt-get update |
| 50 |
sudo apt-get install -y --no-install-recommends xz-utils liblz4-tool musl-tools |
| 51 |
- name: Install Rust |
| 52 |
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 |
| 53 |
with: |
| 54 |
toolchain: stable |
| 55 |
target: ${{ matrix.target }} |
| 56 |
- name: Build release binary |
| 57 |
shell: bash |
| 58 |
run: cargo build --target ${{ matrix.target }} --verbose --release |
| 59 |
- name: Build archive |
| 60 |
shell: bash |
| 61 |
run: | |
| 62 |
outdir="target/${{ matrix.target }}/release" |
| 63 |
staging="jj-${RELEASE_TAG_NAME}-${{ matrix.target }}" |
| 64 |
mkdir "$staging" |
| 65 |
cp {README.md,LICENSE} "$staging/" |
| 66 |
if [[ "${{ matrix.os }}" == windows* ]]; then |
| 67 |
cp "$outdir/jj.exe" "$staging/" |
| 68 |
cd "$staging" |
| 69 |
7z a "../$staging.zip" . |
| 70 |
echo "ASSET=$staging.zip" >> $GITHUB_ENV |
| 71 |
else |
| 72 |
cp "$outdir/jj" "$staging/" |
| 73 |
tar czf "$staging.tar.gz" -C "$staging" . |
| 74 |
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV |
| 75 |
fi |
| 76 |
env: |
| 77 |
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }} |
| 78 |
- name: Upload release archive |
| 79 |
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 |
| 80 |
env: |
| 81 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 82 |
with: |
| 83 |
upload_url: ${{ github.event.release.upload_url }} |
| 84 |
asset_path: ${{ env.ASSET }} |
| 85 |
asset_name: ${{ env.ASSET }} |
| 86 |
asset_content_type: application/octet-stream |
| 87 |
|
| 88 |
docs-release-archive: |
| 89 |
runs-on: ubuntu-24.04 |
| 90 |
permissions: |
| 91 |
contents: write |
| 92 |
|
| 93 |
steps: |
| 94 |
- name: Install packages (Ubuntu) |
| 95 |
run: | |
| 96 |
sudo apt-get update |
| 97 |
sudo apt-get install -y --no-install-recommends xz-utils liblz4-tool musl-tools |
| 98 |
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 |
| 99 |
with: |
| 100 |
persist-credentials: false |
| 101 |
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 |
| 102 |
with: |
| 103 |
python-version: 3.11 |
| 104 |
- name: Install uv |
| 105 |
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 |
| 106 |
with: |
| 107 |
version: "0.5.1" |
| 108 |
enable-cache: false |
| 109 |
- name: Compile docs and zip them up |
| 110 |
run: | |
| 111 |
uv run mkdocs build |
| 112 |
archive="jj-${RELEASE_TAG_NAME}-docs-html.tar.gz" |
| 113 |
tar czf "$archive" -C "rendered-docs" . |
| 114 |
echo "ASSET=$archive" >> $GITHUB_ENV |
| 115 |
env: |
| 116 |
MKDOCS_OFFLINE: true |
| 117 |
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }} |
| 118 |
- name: Upload release archive |
| 119 |
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 |
| 120 |
env: |
| 121 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 122 |
with: |
| 123 |
upload_url: ${{ github.event.release.upload_url }} |
| 124 |
asset_path: ${{ env.ASSET }} |
| 125 |
asset_name: ${{ env.ASSET }} |
| 126 |
asset_content_type: application/octet-stream |
| 127 |
|
| 128 |
docs-deploy-website-latest-release: |
| 129 |
runs-on: ubuntu-24.04 |
| 130 |
permissions: |
| 131 |
contents: write |
| 132 |
|
| 133 |
steps: |
| 134 |
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 |
| 135 |
with: |
| 136 |
# `.github/scripts/docs-build-deploy` will need to `git push` to the docs branch |
| 137 |
persist-credentials: true |
| 138 |
- run: "git fetch origin gh-pages --depth=1" |
| 139 |
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 |
| 140 |
with: |
| 141 |
python-version: 3.11 |
| 142 |
- name: Install uv |
| 143 |
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 |
| 144 |
with: |
| 145 |
version: "0.5.1" |
| 146 |
enable-cache: false |
| 147 |
- name: Install dependencies, compile and deploy docs to the "latest release" section of the website |
| 148 |
run: | |
| 149 |
git config user.name 'jj-docs[bot]' |
| 150 |
git config user.email 'jj-docs[bot]@users.noreply.github.io' |
| 151 |
# Using the 'latest' tag below makes the website default |
| 152 |
# to this version. |
| 153 |
.github/scripts/docs-build-deploy "${RELEASE_TAG_NAME}" latest --update-aliases --push |
| 154 |
env: |
| 155 |
RELEASE_TAG_NAME: ${{ github.event.release.tag_name }} |
| 156 |
- name: "Show `git diff --stat`" |
| 157 |
run: git diff --stat gh-pages^ gh-pages || echo "(No diffs)" |