Skip to content

Commit

Permalink
feat(ci:assets): separate assets binary creation
Browse files Browse the repository at this point in the history
  • Loading branch information
sassman committed Nov 15, 2021
1 parent daf6d2c commit 621e99a
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 13 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/release-binary-assets.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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
14 changes: 1 addition & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}

0 comments on commit 621e99a

Please sign in to comment.