2021-04-30 18:22:33 +02:00
|
|
|
name: CLI Release
|
2021-04-10 13:53:12 +02:00
|
|
|
|
|
|
|
on:
|
2022-06-23 12:29:04 +02:00
|
|
|
workflow_call:
|
2021-06-27 13:54:15 +02:00
|
|
|
workflow_dispatch:
|
2021-04-10 13:53:12 +02:00
|
|
|
push:
|
|
|
|
tags:
|
2022-09-07 01:24:53 +02:00
|
|
|
- "v*.*.*"
|
2021-04-10 13:53:12 +02:00
|
|
|
|
2022-09-07 04:15:38 +02:00
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
|
|
|
|
|
2021-04-10 13:53:12 +02:00
|
|
|
jobs:
|
2022-06-23 12:29:04 +02:00
|
|
|
info:
|
|
|
|
name: Gather info
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
cli_version: ${{ steps.version.outputs.cli_version }}
|
2022-06-29 06:52:45 +02:00
|
|
|
release_notes: ${{ fromJSON(steps.notes.outputs.notes_json) }}
|
2022-06-29 04:21:57 +02:00
|
|
|
announce: ${{ steps.announce.outputs.announce }}
|
2022-06-23 12:29:04 +02:00
|
|
|
steps:
|
2022-09-07 04:15:38 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-06-23 12:29:04 +02:00
|
|
|
- name: Extract version
|
|
|
|
id: version
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
set -euxo pipefail
|
|
|
|
|
|
|
|
version=$(grep -m1 -F 'version =' crates/cli/Cargo.toml | cut -d\" -f2)
|
|
|
|
|
|
|
|
if [[ -z "$version" ]]; then
|
|
|
|
echo "Error: no version :("
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "::set-output name=cli_version::$version"
|
|
|
|
|
2022-06-29 04:21:57 +02:00
|
|
|
- name: Extract release notes
|
|
|
|
id: notes
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
GITHUB_REPO: ${{ github.repository }}
|
|
|
|
release_commit: ${{ github.event.head_commit.message }}
|
|
|
|
run: |
|
|
|
|
set -euxo pipefail
|
|
|
|
release_pr=$(head -n1 <<< "${release_commit:-}" | grep -oP '(?<=[(]#)\d+(?=[)])')
|
|
|
|
if [[ -z "$release_pr" ]]; then
|
2022-06-29 06:52:45 +02:00
|
|
|
echo "::set-output name=notes_json::null"
|
2022-06-29 04:21:57 +02:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2022-06-29 06:52:45 +02:00
|
|
|
gh \
|
2022-06-29 04:21:57 +02:00
|
|
|
pr --repo "$GITHUB_REPO" \
|
|
|
|
view "$release_pr" \
|
|
|
|
--json body \
|
2022-06-29 06:52:45 +02:00
|
|
|
--jq '"::set-output name=notes_json::\((.body | split("### Release notes")[1] // "") | tojson)"'
|
2022-06-29 04:21:57 +02:00
|
|
|
|
|
|
|
- name: Make a new announcement post
|
|
|
|
id: announce
|
|
|
|
if: endsWith(steps.version.outputs.cli_version, '.0')
|
|
|
|
run: echo "::set-output name=announce::Announcements"
|
2022-06-29 06:52:45 +02:00
|
|
|
# TODO: append patch release notes as comments on minor version announce discussion
|
|
|
|
# TODO: add link to discussion from patch release notes
|
|
|
|
# TODO: rename minor version announce discussion to be just CLI vX.Y (remove .0)
|
2022-06-29 04:21:57 +02:00
|
|
|
|
2021-04-10 13:53:12 +02:00
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
name:
|
|
|
|
- linux-amd64-gnu
|
|
|
|
- linux-amd64-musl
|
|
|
|
- linux-i686-musl
|
|
|
|
- linux-armhf-gnu
|
|
|
|
- linux-arm64-gnu
|
2021-09-05 22:42:20 +02:00
|
|
|
- linux-arm64-musl
|
2022-08-03 13:27:28 +02:00
|
|
|
- linux-s390x-gnu
|
|
|
|
- linux-ppc64le-gnu
|
2021-04-10 13:53:12 +02:00
|
|
|
- mac-x86-64
|
2021-04-21 00:00:15 +02:00
|
|
|
- mac-arm64
|
2021-04-10 13:53:12 +02:00
|
|
|
- windows-x86-64
|
|
|
|
include:
|
|
|
|
- name: linux-amd64-gnu
|
|
|
|
os: ubuntu-latest
|
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
cross: false
|
2021-04-21 00:00:15 +02:00
|
|
|
experimental: false
|
2021-04-10 13:53:12 +02:00
|
|
|
|
|
|
|
- name: linux-amd64-musl
|
|
|
|
os: ubuntu-latest
|
|
|
|
target: x86_64-unknown-linux-musl
|
|
|
|
cross: true
|
2021-04-21 00:00:15 +02:00
|
|
|
experimental: false
|
2021-04-10 13:53:12 +02:00
|
|
|
|
|
|
|
- name: linux-i686-musl
|
|
|
|
os: ubuntu-latest
|
|
|
|
target: i686-unknown-linux-musl
|
|
|
|
cross: true
|
2021-04-21 00:00:15 +02:00
|
|
|
experimental: true
|
2021-04-10 13:53:12 +02:00
|
|
|
|
|
|
|
- name: linux-armhf-gnu
|
|
|
|
os: ubuntu-latest
|
|
|
|
target: armv7-unknown-linux-gnueabihf
|
|
|
|
cross: true
|
2021-04-21 00:00:15 +02:00
|
|
|
experimental: false
|
2021-04-10 13:53:12 +02:00
|
|
|
|
|
|
|
- name: linux-arm64-gnu
|
|
|
|
os: ubuntu-latest
|
|
|
|
target: aarch64-unknown-linux-gnu
|
|
|
|
cross: true
|
2021-04-21 00:00:15 +02:00
|
|
|
experimental: false
|
2022-01-12 13:02:22 +01:00
|
|
|
|
2021-09-05 22:42:20 +02:00
|
|
|
- name: linux-arm64-musl
|
|
|
|
os: ubuntu-latest
|
|
|
|
target: aarch64-unknown-linux-musl
|
|
|
|
cross: true
|
|
|
|
experimental: true
|
2021-04-10 13:53:12 +02:00
|
|
|
|
2022-08-03 13:27:28 +02:00
|
|
|
- name: linux-s390x-gnu
|
|
|
|
os: ubuntu-latest
|
|
|
|
target: s390x-unknown-linux-gnu
|
|
|
|
cross: true
|
|
|
|
experimental: false
|
|
|
|
|
|
|
|
- name: linux-ppc64le-gnu
|
|
|
|
os: ubuntu-latest
|
|
|
|
target: powerpc64le-unknown-linux-gnu
|
|
|
|
cross: true
|
|
|
|
experimental: false
|
|
|
|
|
2021-04-10 13:53:12 +02:00
|
|
|
- name: mac-x86-64
|
|
|
|
os: macos-latest
|
|
|
|
target: x86_64-apple-darwin
|
|
|
|
cross: false
|
2021-04-21 00:00:15 +02:00
|
|
|
experimental: false
|
|
|
|
|
|
|
|
- name: mac-arm64
|
2021-04-30 16:25:10 +02:00
|
|
|
os: macos-11.0
|
2021-04-21 00:00:15 +02:00
|
|
|
target: aarch64-apple-darwin
|
|
|
|
cross: true
|
|
|
|
experimental: true
|
2021-04-10 13:53:12 +02:00
|
|
|
|
|
|
|
- name: windows-x86-64
|
|
|
|
os: windows-latest
|
|
|
|
target: x86_64-pc-windows-msvc
|
|
|
|
cross: false
|
2021-04-21 00:00:15 +02:00
|
|
|
experimental: false
|
2021-04-10 13:53:12 +02:00
|
|
|
|
2022-01-25 22:25:33 +01:00
|
|
|
#- name: windows-arm64
|
|
|
|
# os: windows-latest
|
|
|
|
# target: aarch64-pc-windows-msvc
|
|
|
|
# cross: true
|
|
|
|
# experimental: true
|
2021-04-30 16:26:33 +02:00
|
|
|
|
2021-04-10 13:53:12 +02:00
|
|
|
name: Binaries for ${{ matrix.name }}
|
2022-06-23 12:29:04 +02:00
|
|
|
needs: info
|
2021-04-10 13:53:12 +02:00
|
|
|
runs-on: ${{ matrix.os }}
|
2021-04-21 00:00:15 +02:00
|
|
|
continue-on-error: ${{ matrix.experimental }}
|
2021-04-10 13:53:12 +02:00
|
|
|
|
2022-06-23 12:29:04 +02:00
|
|
|
env:
|
|
|
|
version: ${{ needs.info.outputs.cli_version }}
|
|
|
|
dst: watchexec-${{ needs.info.outputs.cli_version }}-${{ matrix.target }}
|
|
|
|
|
2021-04-10 13:53:12 +02:00
|
|
|
steps:
|
2022-09-07 04:15:38 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-09-07 05:41:34 +02:00
|
|
|
|
|
|
|
# https://github.com/actions/cache/issues/752
|
|
|
|
- if: ${{ runner.os == 'Windows' }}
|
|
|
|
name: Use GNU tar
|
|
|
|
shell: cmd
|
|
|
|
run: |
|
|
|
|
echo "Adding GNU tar to PATH"
|
|
|
|
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
|
|
|
|
|
2022-09-07 04:15:38 +02:00
|
|
|
- name: Configure caching
|
|
|
|
uses: actions/cache@v3
|
2021-04-10 13:53:12 +02:00
|
|
|
with:
|
2022-09-07 04:15:38 +02:00
|
|
|
path: |
|
|
|
|
~/.cargo/registry/index/
|
|
|
|
~/.cargo/registry/cache/
|
|
|
|
~/.cargo/git/db/
|
|
|
|
target/
|
|
|
|
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-cargo-${{ matrix.target }}-
|
|
|
|
${{ runner.os }}-cargo-
|
2021-06-27 13:55:40 +02:00
|
|
|
|
2022-01-23 01:44:09 +01:00
|
|
|
- name: Add musl tools
|
|
|
|
run: sudo apt install -y musl musl-dev musl-tools
|
|
|
|
if: endsWith(matrix.target, '-musl')
|
|
|
|
- name: Add aarch-gnu tools
|
|
|
|
run: sudo apt install -y gcc-aarch64-linux-gnu
|
|
|
|
if: startsWith(matrix.target, 'aarch64-unknown-linux')
|
|
|
|
- name: Add arm7hf-gnu tools
|
|
|
|
run: sudo apt install -y gcc-arm-linux-gnueabihf
|
|
|
|
if: startsWith(matrix.target, 'armv7-unknown-linux-gnueabihf')
|
2022-08-03 13:27:28 +02:00
|
|
|
- name: Add s390x-gnu tools
|
|
|
|
run: sudo apt install -y gcc-s390x-linux-gnu
|
|
|
|
if: startsWith(matrix.target, 's390x-unknown-linux-gnu')
|
|
|
|
- name: Add ppc64le-gnu tools
|
|
|
|
run: sudo apt install -y gcc-powerpc64le-linux-gnu
|
|
|
|
if: startsWith(matrix.target, 'powerpc64le-unknown-linux-gnu')
|
2022-01-23 01:44:09 +01:00
|
|
|
|
2021-06-27 13:55:40 +02:00
|
|
|
- name: Install cargo-deb
|
2021-07-21 16:14:03 +02:00
|
|
|
if: startsWith(matrix.name, 'linux-')
|
2022-09-07 04:15:38 +02:00
|
|
|
uses: taiki-e/install-action@v1
|
2022-03-18 02:12:23 +01:00
|
|
|
with:
|
2022-09-07 04:15:38 +02:00
|
|
|
tool: cargo-deb
|
2022-03-18 02:12:23 +01:00
|
|
|
|
2022-01-18 12:20:23 +01:00
|
|
|
- name: Install cargo-generate-rpm
|
|
|
|
if: startsWith(matrix.name, 'linux-')
|
2022-09-07 04:15:38 +02:00
|
|
|
uses: taiki-e/install-action@v1
|
2022-03-18 02:12:23 +01:00
|
|
|
with:
|
2022-09-07 04:15:38 +02:00
|
|
|
tool: cargo-generate-rpm
|
2021-06-27 13:55:56 +02:00
|
|
|
|
2022-09-07 04:15:38 +02:00
|
|
|
- name: Configure toolchain
|
|
|
|
run: |
|
|
|
|
rustup toolchain install --profile minimal --no-self-update stable
|
|
|
|
rustup default stable
|
2022-09-07 08:00:08 +02:00
|
|
|
rustup target add ${{ matrix.target }}
|
2021-06-27 13:54:15 +02:00
|
|
|
|
2022-09-07 04:15:38 +02:00
|
|
|
- name: Install cross
|
|
|
|
if: matrix.cross
|
|
|
|
uses: taiki-e/install-action@v1
|
2021-04-10 13:53:12 +02:00
|
|
|
with:
|
2022-09-07 04:15:38 +02:00
|
|
|
tool: cross
|
|
|
|
|
|
|
|
- name: Build (cargo)
|
|
|
|
if: "!matrix.cross"
|
|
|
|
run: cargo build --package watchexec-cli --release --locked --target ${{ matrix.target }}
|
|
|
|
|
|
|
|
- name: Build (cross)
|
|
|
|
if: matrix.cross
|
|
|
|
run: cross build --package watchexec-cli --release --locked --target ${{ matrix.target }}
|
2021-06-27 13:54:15 +02:00
|
|
|
|
2021-04-10 13:53:12 +02:00
|
|
|
- name: Package
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
set -euxo pipefail
|
|
|
|
ext=""
|
|
|
|
[[ "${{ matrix.name }}" == windows-* ]] && ext=".exe"
|
|
|
|
bin="target/${{ matrix.target }}/release/watchexec${ext}"
|
2022-09-07 08:00:08 +02:00
|
|
|
objcopy --compress-debug-sections "$bin" || true
|
2021-07-21 16:14:03 +02:00
|
|
|
|
2021-04-10 13:53:12 +02:00
|
|
|
mkdir "$dst"
|
2021-07-21 16:14:03 +02:00
|
|
|
|
|
|
|
mkdir -p "target/release"
|
|
|
|
cp "$bin" "target/release/" # workaround for cargo-deb silliness with targets
|
|
|
|
|
2021-06-27 13:55:56 +02:00
|
|
|
cp "$bin" "$dst/"
|
2022-06-23 12:29:04 +02:00
|
|
|
cp -r crates/cli/README.md LICENSE completions doc/{logo.svg,watchexec.1{,.html}} "$dst/"
|
2021-06-27 13:54:15 +02:00
|
|
|
|
2021-04-10 13:53:12 +02:00
|
|
|
- name: Archive (tar)
|
|
|
|
if: '! startsWith(matrix.name, ''windows-'')'
|
2022-06-23 12:29:04 +02:00
|
|
|
run: tar cavf "$dst.tar.xz" "$dst"
|
2021-04-10 13:53:12 +02:00
|
|
|
- name: Archive (deb)
|
|
|
|
if: startsWith(matrix.name, 'linux-')
|
2022-06-23 12:29:04 +02:00
|
|
|
run: cargo deb -p watchexec-cli --no-build --no-strip --target ${{ matrix.target }} --output "$dst.deb"
|
2022-01-18 12:20:23 +01:00
|
|
|
- name: Archive (rpm)
|
|
|
|
if: startsWith(matrix.name, 'linux-')
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
set -euxo pipefail
|
|
|
|
shopt -s globstar
|
2022-06-23 12:29:04 +02:00
|
|
|
cargo generate-rpm -p crates/cli --target "${{ matrix.target }}" --target-dir "target/${{ matrix.target }}"
|
2022-01-18 12:20:23 +01:00
|
|
|
mv target/**/*.rpm "$dst.rpm"
|
2021-04-10 13:53:12 +02:00
|
|
|
- name: Archive (zip)
|
|
|
|
if: startsWith(matrix.name, 'windows-')
|
2022-06-28 15:40:21 +02:00
|
|
|
shell: bash
|
2022-06-23 12:29:04 +02:00
|
|
|
run: 7z a "$dst.zip" "$dst"
|
2021-06-27 13:54:15 +02:00
|
|
|
|
2022-09-07 04:15:38 +02:00
|
|
|
- uses: actions/upload-artifact@v3
|
2021-06-27 13:54:15 +02:00
|
|
|
with:
|
|
|
|
name: builds
|
|
|
|
retention-days: 1
|
|
|
|
path: |
|
|
|
|
watchexec-*.tar.xz
|
|
|
|
watchexec-*.tar.zst
|
|
|
|
watchexec-*.deb
|
|
|
|
watchexec-*.rpm
|
|
|
|
watchexec-*.zip
|
|
|
|
|
|
|
|
sign:
|
2022-06-23 12:29:04 +02:00
|
|
|
needs: [build, info]
|
2021-06-27 13:54:15 +02:00
|
|
|
|
|
|
|
name: Checksum and sign
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2022-09-07 04:15:38 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-06-27 13:54:15 +02:00
|
|
|
|
|
|
|
- name: Install rsign2
|
2022-09-07 04:15:38 +02:00
|
|
|
uses: taiki-e/install-action@v1
|
2022-03-18 02:12:23 +01:00
|
|
|
with:
|
2022-09-07 04:15:38 +02:00
|
|
|
tool: rsign2
|
2022-03-18 02:12:23 +01:00
|
|
|
|
2021-06-27 13:54:15 +02:00
|
|
|
- name: Install b3sum
|
2022-09-07 04:15:38 +02:00
|
|
|
uses: taiki-e/install-action@v1
|
2022-03-18 02:12:23 +01:00
|
|
|
with:
|
2022-09-07 04:15:38 +02:00
|
|
|
tool: b3sum
|
2021-06-27 13:54:15 +02:00
|
|
|
|
2022-09-07 04:15:38 +02:00
|
|
|
- uses: actions/download-artifact@v3
|
2021-06-27 13:54:15 +02:00
|
|
|
with:
|
|
|
|
name: builds
|
|
|
|
|
|
|
|
- name: Checksums with BLAKE3
|
|
|
|
run: b3sum watchexec-* | tee B3SUMS
|
|
|
|
|
|
|
|
- name: Checksums with SHA512
|
|
|
|
run: sha512sum watchexec-* | tee SHA512SUMS
|
|
|
|
|
|
|
|
- name: Sign checksums
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
RELEASE_KEY: ${{ secrets.RELEASE_KEY }}
|
2022-06-29 06:52:45 +02:00
|
|
|
version: ${{ needs.info.outputs.cli_version }}
|
2021-06-27 13:54:15 +02:00
|
|
|
run: |
|
|
|
|
set -u
|
|
|
|
echo "$RELEASE_KEY" > release.key
|
|
|
|
set -x
|
|
|
|
for algo in B3 SHA512; do
|
|
|
|
echo | rsign sign \
|
|
|
|
-p .github/workflows/release.pub \
|
|
|
|
-s release.key \
|
|
|
|
-t "watchexec 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
|
|
|
|
|
2022-11-13 09:45:59 +01:00
|
|
|
- uses: softprops/action-gh-release@cd28b0f5ee8571b76cfdaa62a30d51d752317477
|
2021-04-10 13:53:12 +02:00
|
|
|
with:
|
2022-09-07 08:35:00 +02:00
|
|
|
tag_name: v${{ needs.info.outputs.cli_version }}
|
2022-06-29 06:52:45 +02:00
|
|
|
name: CLI v${{ needs.info.outputs.cli_version }}
|
2022-06-29 04:21:57 +02:00
|
|
|
body: ${{ needs.info.outputs.release_notes }}
|
|
|
|
append_body: true
|
|
|
|
discussion_category_name: ${{ needs.info.outputs.announce }}
|
2021-04-10 13:53:12 +02:00
|
|
|
files: |
|
|
|
|
watchexec-*.tar.xz
|
2021-06-27 13:54:15 +02:00
|
|
|
watchexec-*.tar.zst
|
2021-04-10 13:53:12 +02:00
|
|
|
watchexec-*.deb
|
2021-06-27 13:54:15 +02:00
|
|
|
watchexec-*.rpm
|
2021-04-10 13:53:12 +02:00
|
|
|
watchexec-*.zip
|
2021-06-27 13:54:15 +02:00
|
|
|
*SUMS*
|
2021-04-10 13:53:12 +02:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|