Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: include generated assets in release archive #359

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 27 additions & 23 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ jobs:
env:
# Emit backtraces on panics.
RUST_BACKTRACE: 1
BANDWHICH_GEN_DIR: assets
PKGDIR: github-actions-pkg
strategy:
matrix:
build:
Expand Down Expand Up @@ -83,38 +85,40 @@ jobs:
run: sudo apt-get install -y --no-install-recommends musl-tools

- name: Build release binary
shell: bash
env:
RUSTFLAGS: "-C strip=symbols"
run: cargo build --verbose --release --target ${{ matrix.target }}
run: |
mkdir -p "$BANDWHICH_GEN_DIR"
cargo build --verbose --release --target ${{ matrix.target }}

- name: Tar release (unix)
if: matrix.os != 'windows-latest'
working-directory: ./target/${{ matrix.target }}/release
run: tar cvfz bandwhich-${{ github.ref_name }}-${{matrix.target}}.tar.gz "bandwhich"
- name: Collect build artifacts
shell: bash
env:
BANDWHICH_BIN: ${{ contains(matrix.os, 'windows') && 'bandwhich.exe' || 'bandwhich' }}
run: |
mkdir "$PKGDIR"
mv "target/${{ matrix.target }}/release/$BANDWHICH_BIN" "$PKGDIR"
mv "$BANDWHICH_GEN_DIR" "$PKGDIR"

- name: Zip Windows release
if: matrix.os == 'windows-latest'
working-directory: ./target/${{ matrix.target }}/release
run: tar.exe -a -c -f bandwhich-${{ github.ref_name }}-${{matrix.target}}.zip "bandwhich.exe"
- name: Tar release (Unix)
if: ${{ !contains(matrix.os, 'windows') }}
working-directory: ${{ env.PKGDIR }}
run: tar cvfz bandwhich-${{ github.ref_name }}-${{ matrix.target }}.tar.gz *

- name: Upload release archive (unix)
if: matrix.os != 'windows-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./target/${{ matrix.target }}/release/bandwhich-${{ github.ref_name }}-${{matrix.target}}.tar.gz
asset_name: bandwhich-${{ github.ref_name }}-${{matrix.target}}.tar.gz
asset_content_type: application/octet-stream
- name: Zip release (Windows)
if: contains(matrix.os, 'windows')
shell: bash
working-directory: ${{ env.PKGDIR }}
run: tar.exe -a -c -f bandwhich-${{ github.ref_name }}-${{ matrix.target }}.zip *

- name: Upload Windows release archive
if: matrix.os == 'windows-latest'
- name: Upload release archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARCHIVE_EXT: ${{ contains(matrix.os, 'windows') && 'zip' || 'tar.gz' }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./target/${{ matrix.target }}/release/bandwhich-${{ github.ref_name }}-${{matrix.target}}.zip
asset_name: bandwhich-${{ github.ref_name }}-${{matrix.target}}.zip
asset_path: ${{ env.PKGDIR }}/bandwhich-${{ github.ref_name }}-${{ matrix.target }}.${{ env.ARCHIVE_EXT }}
asset_name: bandwhich-${{ github.ref_name }}-${{ matrix.target }}.${{ env.ARCHIVE_EXT }}
asset_content_type: application/octet-stream
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]

## Added
* CI: include generated assets in release archive #359 - @cyqsimon

## Changed
* CI: strip release binaries for all targets #358 - @cyqsimon

Expand Down
Loading