-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update all Actions dependencies * Use Rust triple instead of LLVM triple * Remove unnecessary explicit installation of clippy * Switch to zstd compression for Linux tarballs Signed-off-by: Andrew Gunnerson <[email protected]>
- Loading branch information
1 parent
6e00ad4
commit ea62b37
Showing
2 changed files
with
34 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,16 +2,15 @@ | |
on: | ||
push: | ||
# Uncomment to test against a branch | ||
#branches: | ||
# - ci | ||
branches: | ||
- ci | ||
tags: | ||
- 'v*' | ||
jobs: | ||
create_release: | ||
name: Create GitHub release | ||
get_version: | ||
name: Get version | ||
runs-on: ubuntu-latest | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
version: ${{ steps.get_version.outputs.version }} | ||
steps: | ||
- name: Get version from tag | ||
|
@@ -24,85 +23,69 @@ jobs: | |
fi | ||
echo "version=${version}" >> "${GITHUB_OUTPUT}" | ||
- name: Create release | ||
id: create_release | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ steps.get_version.outputs.version }} | ||
release_name: Version ${{ steps.get_version.outputs.version }} | ||
draft: false | ||
prerelease: false | ||
|
||
build_and_upload: | ||
name: Build and upload assets | ||
needs: create_release | ||
needs: get_version | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
CARGO_TERM_COLOR: always | ||
RUSTFLAGS: -C strip=symbols | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [windows-latest, ubuntu-latest] | ||
os: | ||
- windows-latest | ||
- ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Get Rust LLVM target triple | ||
- name: Get Rust target triple | ||
id: get_target | ||
shell: bash | ||
run: | | ||
echo -n 'name=' >> "${GITHUB_OUTPUT}" | ||
RUSTC_BOOTSTRAP=1 rustc -Z unstable-options --print target-spec-json \ | ||
| jq -r '."llvm-target"' \ | ||
>> "${GITHUB_OUTPUT}" | ||
rustc -vV | sed -n 's|host: ||p' >> "${GITHUB_OUTPUT}" | ||
- name: Install build dependencies | ||
if: matrix.os == 'ubuntu-latest' | ||
run: sudo apt install -y libdbus-1-dev | ||
|
||
- name: Install clippy | ||
run: rustup component add clippy | ||
|
||
- name: Run clippy checks in release mode | ||
env: | ||
RUST_BACKTRACE: 1 | ||
run: | | ||
cargo clippy --workspace --release -- -D warnings | ||
- name: Build in release mode | ||
run: cargo build --release --verbose | ||
|
||
- name: Strip release binary (non-Windows) | ||
if: matrix.os == 'ubuntu-latest' | ||
run: strip target/release/svrbsctl | ||
run: cargo build --release | ||
|
||
- name: Build archive | ||
id: build_archive | ||
shell: bash | ||
run: | | ||
base_name=svrbsctl-${{ needs.create_release.outputs.version }}-${{ steps.get_target.outputs.name }} | ||
base_name=svrbsctl-${{ needs.get_version.outputs.version }}-${{ steps.get_target.outputs.name }} | ||
mkdir "${base_name}" | ||
cp {README.md,LICENSE} "${base_name}/" | ||
if [[ "${{ matrix.os }}" == windows-* ]]; then | ||
cp target/release/svrbsctl.exe "${base_name}/" | ||
7z a "${base_name}.zip" "${base_name}" | ||
echo "ASSET=${base_name}.zip" >> "${GITHUB_ENV}" | ||
echo "name=${base_name}.zip" >> "${GITHUB_OUTPUT}" | ||
else | ||
cp target/release/svrbsctl "${base_name}/" | ||
tar -Jcvf "${base_name}.tar.xz" "${base_name}" | ||
echo "ASSET=${base_name}.tar.xz" >> "${GITHUB_ENV}" | ||
tar -I zstd -cvf "${base_name}.tar.zst" "${base_name}" | ||
echo "name=${base_name}.tar.zst" >> "${GITHUB_OUTPUT}" | ||
fi | ||
- name: Upload release assets | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
upload_url: ${{ needs.create_release.outputs.upload_url }} | ||
asset_name: ${{ env.ASSET }} | ||
asset_path: ${{ env.ASSET }} | ||
asset_content_type: application/octet-stream | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag_name: v${{ needs.get_version.outputs.version }} | ||
name: Version ${{ needs.get_version.outputs.version }} | ||
draft: true | ||
prerelease: false | ||
files: ${{ steps.build_archive.outputs.name }} |