Skip to content

Commit 8070608

Browse files
authored
Merge pull request #22 from randomlogin/main
Added a github action workflow to build binaries and create a release
2 parents a73e958 + 02dd1ca commit 8070608

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/release.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build binaries and create release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
release:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [macos-latest, ubuntu-latest, macos-13] # Specify the runners you want to use
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
# Dynamically create a tag from the pushed version
20+
- name: Get the tag name
21+
id: get_tag
22+
run: |
23+
echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
24+
25+
- name: Set up Rust
26+
uses: actions-rust-lang/setup-rust-toolchain@v1
27+
28+
- name: Build release binary
29+
run: cargo build --release
30+
31+
# Perhaps we can ignore tests, as they are run by the CI workflow
32+
# - name: Run tests
33+
# run: cargo test --release
34+
#
35+
36+
- name: Get OS and architecture
37+
run: |
38+
echo "os=$(uname -s | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
39+
echo "arch=$(uname -m)" >> $GITHUB_ENV
40+
41+
- name: Create release archive
42+
run: |
43+
mkdir -p release
44+
ARCH="${{ env.arch }}"
45+
OS="${{ env.os }}"
46+
cp target/release/spaced release/spaced-${{ env.TAG }}-${OS}-${ARCH}
47+
cp target/release/space-cli release/space-cli-${{ env.TAG }}-${OS}-${ARCH}
48+
49+
- name: Create GitHub Release
50+
id: create_release
51+
uses: softprops/action-gh-release@v2
52+
with:
53+
tag_name: ${{ env.TAG }} # Dynamically use the pushed tag
54+
name: Release ${{ env.TAG }} # Use the tag for the release name
55+
body: |
56+
Spaces release of version ${{ env.TAG }}.
57+
draft: false
58+
prerelease: false
59+
files: |
60+
release/spaced-${{ env.TAG }}-${{ env.os }}-${{ env.arch }}
61+
release/space-cli-${{ env.TAG }}-${{ env.os }}-${{ env.arch }}
62+
make_latest: true
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)