-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from randomlogin/main
Added a github action workflow to build binaries and create a release
- Loading branch information
Showing
1 changed file
with
64 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,64 @@ | ||
name: Build binaries and create release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
release: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [macos-latest, ubuntu-latest, macos-13] # Specify the runners you want to use | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Dynamically create a tag from the pushed version | ||
- name: Get the tag name | ||
id: get_tag | ||
run: | | ||
echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV | ||
- name: Set up Rust | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
|
||
- name: Build release binary | ||
run: cargo build --release | ||
|
||
# Perhaps we can ignore tests, as they are run by the CI workflow | ||
# - name: Run tests | ||
# run: cargo test --release | ||
# | ||
|
||
- name: Get OS and architecture | ||
run: | | ||
echo "os=$(uname -s | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
echo "arch=$(uname -m)" >> $GITHUB_ENV | ||
- name: Create release archive | ||
run: | | ||
mkdir -p release | ||
ARCH="${{ env.arch }}" | ||
OS="${{ env.os }}" | ||
cp target/release/spaced release/spaced-${{ env.TAG }}-${OS}-${ARCH} | ||
cp target/release/space-cli release/space-cli-${{ env.TAG }}-${OS}-${ARCH} | ||
- name: Create GitHub Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
tag_name: ${{ env.TAG }} # Dynamically use the pushed tag | ||
name: Release ${{ env.TAG }} # Use the tag for the release name | ||
body: | | ||
Spaces release of version ${{ env.TAG }}. | ||
draft: false | ||
prerelease: false | ||
files: | | ||
release/spaced-${{ env.TAG }}-${{ env.os }}-${{ env.arch }} | ||
release/space-cli-${{ env.TAG }}-${{ env.os }}-${{ env.arch }} | ||
make_latest: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |