Skip to content

Commit 9826bba

Browse files
added release
1 parent 224573c commit 9826bba

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

.github/workflows/release.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build_release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Install Rust Toolchain
18+
uses: actions-rs/toolchain@v1
19+
with:
20+
toolchain: stable
21+
profile: minimal
22+
override: true
23+
24+
- name: Build and Extract Version
25+
run: |
26+
cargo build --release
27+
echo "::set-output name=version::$(./target/release/snip --version)"
28+
id: version
29+
30+
- name: Build Artifacts for Different Platforms
31+
run: |
32+
rustup target add x86_64-unknown-linux-gnu
33+
rustup target add x86_64-pc-windows-gnu
34+
rustup target add x86_64-apple-darwin
35+
cargo build --target x86_64-unknown-linux-gnu --release
36+
cargo build --target x86_64-pc-windows-gnu --release
37+
cargo build --target x86_64-apple-darwin --release
38+
39+
- name: Create Release
40+
uses: actions/create-release@v1
41+
id: create_release
42+
with:
43+
draft: false
44+
prerelease: false
45+
release_name: ${{ steps.version.outputs.version }}
46+
tag_name: ${{ github.ref }}
47+
body_path: CHANGELOG.md
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Upload Linux Artifact
52+
uses: actions/upload-release-asset@v1
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
with:
56+
upload_url: ${{ steps.create_release.outputs.upload_url }}
57+
asset_path: ./target/x86_64-unknown-linux-gnu/release/snip
58+
asset_name: snip-linux-x86_64
59+
asset_content_type: application/octet-stream
60+
61+
- name: Upload Darwin Artifact
62+
uses: actions/upload-release-asset@v1
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
with:
66+
upload_url: ${{ steps.create_release.outputs.upload_url }}
67+
asset_path: ./target/x86_64-apple-darwin/release/snip
68+
asset_name: snip-darwin-x86_64
69+
asset_content_type: application/octet-stream
70+
71+
- name: Upload Windows Artifact
72+
uses: actions/upload-release-asset@v1
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
with:
76+
upload_url: ${{ steps.create_release.outputs.upload_url }}
77+
asset_path: ./target/x86_64-pc-windows-gnu/release/snip.exe
78+
asset_name: snip-windows.exe
79+
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)