-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
224573c
commit 9826bba
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build_release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install Rust Toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
|
||
- name: Build and Extract Version | ||
run: | | ||
cargo build --release | ||
echo "::set-output name=version::$(./target/release/snip --version)" | ||
id: version | ||
|
||
- name: Build Artifacts for Different Platforms | ||
run: | | ||
rustup target add x86_64-unknown-linux-gnu | ||
rustup target add x86_64-pc-windows-gnu | ||
rustup target add x86_64-apple-darwin | ||
cargo build --target x86_64-unknown-linux-gnu --release | ||
cargo build --target x86_64-pc-windows-gnu --release | ||
cargo build --target x86_64-apple-darwin --release | ||
- name: Create Release | ||
uses: actions/create-release@v1 | ||
id: create_release | ||
with: | ||
draft: false | ||
prerelease: false | ||
release_name: ${{ steps.version.outputs.version }} | ||
tag_name: ${{ github.ref }} | ||
body_path: CHANGELOG.md | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload Linux Artifact | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./target/x86_64-unknown-linux-gnu/release/snip | ||
asset_name: snip-linux-x86_64 | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Darwin Artifact | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./target/x86_64-apple-darwin/release/snip | ||
asset_name: snip-darwin-x86_64 | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Windows Artifact | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./target/x86_64-pc-windows-gnu/release/snip.exe | ||
asset_name: snip-windows.exe | ||
asset_content_type: application/octet-stream |