Fix release github action #11
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
name: release | |
on: | |
push: | |
branches: | |
- v0.* | |
jobs: | |
build: | |
name: Build Rust version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install latest stable | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- name: Install deps | |
run: | | |
sudo apt-get install make | |
rustup target add x86_64-apple-darwin | |
- name: Build for linux | |
run: | | |
cargo build --release | |
mv target/release/grotsky-rs ../grotsky-linux | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Prepare Release Linux | |
run: | | |
mv grotsky-linux grotsky | |
tar -czvf grotsky-${{ steps.extract_branch.outputs.branch }}-linux-x86_64.tar.gz grotsky | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.extract_branch.outputs.branch }}-rs | |
release_name: Release ${{ steps.extract_branch.outputs.branch }}-rs | |
body: | | |
Automated Release | |
draft: false | |
prerelease: false | |
- name: Upload Release Linux | |
id: upload-release-linux | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./grotsky-${{ steps.extract_branch.outputs.branch }}-linux-x86_64.tar.gz | |
asset_name: grotsky-${{ steps.extract_branch.outputs.branch }}-linux-x86_64.tar.gz | |
asset_content_type: application/gzip |