diff options
author | cyqsimon <28627918+cyqsimon@users.noreply.github.com> | 2024-01-30 13:29:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-30 13:29:01 +0800 |
commit | b5e48ba9bb466c5e1192755b0235b6b43d1d4966 (patch) | |
tree | 18bc2bd0bb2f9d1d52da1e507a086314a84aa201 | |
parent | aed83d833afa0685761e8f20fee11cd9ee228ae8 (diff) |
CI: include generated assets in release archive (#359)
* CI: include generated assets in release archive
* Write changelog
-rw-r--r-- | .github/workflows/release.yaml | 50 | ||||
-rw-r--r-- | CHANGELOG.md | 3 |
2 files changed, 30 insertions, 23 deletions
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d378e16..a9ea033 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -47,6 +47,8 @@ jobs: env: # Emit backtraces on panics. RUST_BACKTRACE: 1 + BANDWHICH_GEN_DIR: assets + PKGDIR: github-actions-pkg strategy: matrix: build: @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 33b907f..1b96cb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 |