Skip to content

Commit

Permalink
Merge pull request #22 from randomlogin/main
Browse files Browse the repository at this point in the history
Added a github action workflow to build binaries and create a release
  • Loading branch information
buffrr authored Nov 6, 2024
2 parents a73e958 + 02dd1ca commit 8070608
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
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 }}

0 comments on commit 8070608

Please sign in to comment.