Skip to content

Commit 6b88626

Browse files
committed
Add action for building release
1 parent ee4d8b1 commit 6b88626

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/release.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build and upload release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
env:
8+
APP_NAME: code-runner
9+
ARCHIVE_NAME: code-runner_linux-x64.tar.gz
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Install latest rust toolchain
20+
uses: actions-rs/toolchain@v1
21+
with:
22+
toolchain: stable
23+
default: true
24+
override: true
25+
26+
- name: Prepare upload url
27+
run: |
28+
UPLOAD_URL="$(jq -r '.release.upload_url' "$GITHUB_EVENT_PATH" | sed -e "s/{?name,label}$/?name=${ARCHIVE_NAME}/")"
29+
echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV
30+
31+
- name: Build application
32+
run: |
33+
cargo build --release
34+
tar -czf $ARCHIVE_NAME -C target/release $APP_NAME
35+
36+
- name: Upload release asset
37+
uses: actions/upload-release-asset@v1
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
with:
41+
upload_url: ${{ env.UPLOAD_URL }}
42+
asset_path: ${{ env.ARCHIVE_NAME }}
43+
asset_name: ${{ env.ARCHIVE_NAME }}
44+
asset_content_type: application/gzip

0 commit comments

Comments
 (0)