Skip to content

8.5.0

8.5.0 #38

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
tags:
- v*.*.*
jobs:
build:
strategy:
matrix:
name:
- linux-x86-64-gnu
- linux-x86-64-musl
- linux-armhf-gnu
- linux-arm64-gnu
- mac-x86-64
- mac-arm64
- windows-x86-64
- windows-arm64
include:
- name: linux-x86-64-gnu
os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
cross: false
experimental: false
- name: linux-x86-64-musl
os: ubuntu-latest
target: x86_64-unknown-linux-musl
cross: true
experimental: false
- name: linux-armhf-gnu
os: ubuntu-20.04
target: armv7-unknown-linux-gnueabihf
cross: true
experimental: false
- name: linux-arm64-gnu
os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
cross: true
experimental: false
- name: mac-x86-64
os: macos-latest
target: x86_64-apple-darwin
cross: false
experimental: false
- name: mac-arm64
os: macos-11.0
target: aarch64-apple-darwin
cross: true
experimental: true
- name: windows-x86-64
os: windows-latest
target: x86_64-pc-windows-msvc
cross: false
experimental: false
- name: windows-arm64
os: windows-latest
target: aarch64-pc-windows-msvc
cross: true
experimental: true
name: Binaries for ${{ matrix.name }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
- uses: actions/cache@v3
if: startsWith(matrix.name, 'linux-')
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('.github/workflows/release.yml') }}
- name: Install cargo-deb
if: startsWith(matrix.name, 'linux-')
run: which cargo-deb || cargo install cargo-deb --version 1.30.0 --locked
- name: Install cargo-generate-rpm
if: startsWith(matrix.name, 'linux-')
run: which cargo-generate-rpm || cargo install cargo-generate-rpm --version 0.5.0 --locked
- uses: actions-rs/toolchain@v1
with:
target: ${{ matrix.target }}
toolchain: stable
profile: minimal
override: true
- uses: actions-rs/cargo@v1
name: Build
with:
use-cross: ${{ matrix.cross }}
command: build
args: --release --locked --target ${{ matrix.target }}
- name: Extract version
shell: bash
run: |
set -euxo pipefail
version=$(grep -m1 -F 'version =' Cargo.toml | cut -d\" -f2)
if [[ -z "$version" ]]; then
echo "Error: no version :("
exit 1
fi
echo "$version" > VERSION
- name: Package
shell: bash
run: |
set -euxo pipefail
ext=""
[[ "${{ matrix.name }}" == windows-* ]] && ext=".exe"
bin="target/${{ matrix.target }}/release/cargo-watch${ext}"
strip "$bin" || true
version=$(cat VERSION)
dst="cargo-watch-v${version}-${{ matrix.target }}"
mkdir "$dst"
mkdir -p "target/release"
cp "$bin" "target/release/" # workaround for cargo-deb silliness with targets
cp "$bin" "$dst/"
cp -r README.md LICENSE completions cargo-watch.1 "$dst/"
- name: Archive (tar)
if: '! startsWith(matrix.name, ''windows-'')'
shell: bash
run: |
set -euxo pipefail
version=$(cat VERSION)
dst="cargo-watch-v${version}-${{ matrix.target }}"
tar cavf "$dst.tar.xz" "$dst"
- name: Archive (deb)
if: startsWith(matrix.name, 'linux-')
shell: bash
run: |
set -euxo pipefail
version=$(cat VERSION)
dst="cargo-watch-v${version}-${{ matrix.target }}"
cargo deb --no-build --no-strip --target ${{ matrix.target }} --output "$dst.deb"
- name: Archive (rpm)
if: startsWith(matrix.name, 'linux-')
shell: bash
run: |
set -euxo pipefail
shopt -s globstar
version=$(cat VERSION)
dst="cargo-watch-v${version}-${{ matrix.target }}"
cargo generate-rpm --target "${{ matrix.target }}"
mv target/**/*.rpm "$dst.rpm"
- name: Archive (zip)
if: startsWith(matrix.name, 'windows-')
shell: bash
run: |
set -euxo pipefail
version=$(cat VERSION)
dst="cargo-watch-v${version}-${{ matrix.target }}"
7z a "$dst.zip" "$dst"
- uses: actions/upload-artifact@v3
with:
name: builds
retention-days: 1
path: |
cargo-watch-v*.tar.xz
cargo-watch-v*.tar.zst
cargo-watch-v*.deb
cargo-watch-v*.rpm
cargo-watch-v*.zip
sign:
needs: build
name: Checksum and sign
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/.cargo/bin
key: sign-tools-${{ hashFiles('.github/workflows/release.yml') }}
- name: Install rsign2
run: cargo install rsign2 --version 0.5.7
- name: Install b3sum
run: cargo install b3sum --version 0.3.7
- uses: actions/download-artifact@v3
with:
name: builds
- name: Checksums with BLAKE3
run: b3sum cargo-watch-v* | tee B3SUMS
- name: Checksums with SHA512
run: sha512sum cargo-watch-v* | tee SHA512SUMS
- name: Sign checksums
shell: bash
env:
RELEASE_KEY: ${{ secrets.RELEASE_KEY }}
run: |
set -u
echo "$RELEASE_KEY" > release.key
set -x
version=$(grep -m1 -F 'version =' Cargo.toml | cut -d\" -f2)
for algo in B3 SHA512; do
echo | rsign sign \
-p .github/workflows/release.pub \
-s release.key \
-t "cargo-watch v$version signed with automated key" \
-c 'see website for signing information' \
-x "${algo}SUMS.auto.minisig" \
"${algo}SUMS"
done
rm release.key
cat {B3,SHA512}SUMS.auto.minisig
- uses: softprops/action-gh-release@v1
with:
files: |
cargo-watch-v*.tar.xz
cargo-watch-v*.tar.zst
cargo-watch-v*.deb
cargo-watch-v*.rpm
cargo-watch-v*.zip
*SUMS*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}