From 621e99ab0d0f4b27367e31cff8565b0bfffad3e4 Mon Sep 17 00:00:00 2001 From: Sven Assmann Date: Mon, 15 Nov 2021 23:41:21 +0100 Subject: [PATCH] feat(ci:assets): separate assets binary creation --- .github/workflows/release-binary-assets.yml | 82 +++++++++++++++++++++ .github/workflows/release.yml | 14 +--- 2 files changed, 83 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/release-binary-assets.yml diff --git a/.github/workflows/release-binary-assets.yml b/.github/workflows/release-binary-assets.yml new file mode 100644 index 0000000..465fab8 --- /dev/null +++ b/.github/workflows/release-binary-assets.yml @@ -0,0 +1,82 @@ +name: Release Binary Assets +on: + release: + types: + - published +jobs: + release: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-unknown-linux-musl + os: ubuntu-latest + cross: true + binName: stegano + - target: aarch64-unknown-linux-musl + os: ubuntu-latest + cross: true + binName: stegano + - target: x86_64-apple-darwin + os: macos-latest + cross: false + binName: stegano + - target: x86_64-pc-windows-msvc + os: windows-latest + cross: false + binName: stegano.exe + steps: + - uses: actions/checkout@v2 + - name: Setup Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.target }} + override: true + - uses: Swatinem/rust-cache@v1 + - name: Build + uses: actions-rs/cargo@v1 + with: + command: build + use-cross: ${{ matrix.cross }} + args: --release --target=${{ matrix.target }} + - name: Smoke Test + uses: actions-rs/cargo@v1 + with: + command: run + use-cross: ${{ matrix.cross }} + args: --release --target=${{ matrix.target }} -- -V + - run: cargo deb -p stegano-cli + - name: Create Archive + id: archive + shell: bash + env: + TARGET: ${{ matrix.target }} + TAG: ${{ github.event.release.tag_name }} + run: | + filename="stegano-$TAG-$TARGET.tar.gz" + tar -czvf "$filename" README.md LICENSE -C "target/$TARGET/release" "${{ matrix.binName }}" + echo "::set-output name=filename::$filename" + - name: Upload Archive + uses: ncipollo/release-action@v1.8.7 + with: + token: ${{ secrets.GITHUB_TOKEN }} + allowUpdates: true + artifactErrorsFailBuild: true + artifacts: ${{ steps.archive.outputs.filename }} + artifactContentType: application/octet-stream + omitBodyDuringUpdate: true + omitNameDuringUpdate: true + omitPrereleaseDuringUpdate: true + - name: Upload Deb File + uses: ncipollo/release-action@v1.8.7 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + allowUpdates: true + artifactErrorsFailBuild: true + artifacts: ./target/debian/stegano-${{ steps.tag_name.outputs.current_version }}-amd64.deb + artifactContentType: application/vnd.debian.binary-package + omitBodyDuringUpdate: true + omitNameDuringUpdate: true + omitPrereleaseDuringUpdate: true \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f2ddf7e..d886583 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -146,7 +146,6 @@ jobs: validation_depth: 10 version: ${{ steps.tag_name.outputs.current_version }} path: ./CHANGELOG.md - - run: cargo deb -p stegano-cli - name: Create Release id: create_release uses: actions/create-release@v1 @@ -159,15 +158,4 @@ jobs: release_name: Release ${{ steps.changelog_reader.outputs.version }} body: ${{ steps.changelog_reader.outputs.changes }} prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }} - draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }} - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - # https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./target/debian/stegano-cli_${{ steps.tag_name.outputs.current_version }}_amd64.deb - asset_name: stegano_${{ steps.tag_name.outputs.current_version }}_amd64.deb - asset_content_type: application/vnd.debian.binary-package \ No newline at end of file + draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }} \ No newline at end of file