Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a github action workflow to build binaries and create a release #22

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
Loading