Skip to content

Commit

Permalink
chore: add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Jujulego committed Jul 25, 2024
1 parent c500121 commit 8e493ef
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
changelog:
categories:
- title: ":tada: Features"
labels:
- enhancement

- title: ":bug: Bugfixes"
labels:
- bug

- title: ":package: Dependencies"
labels:
- dependencies

- title: ":space_invader: Other"
labels:
- "*"
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rust
name: CI

on:
push:
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: 'Release'

on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+

jobs:
build:
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.runner }}

strategy:
fail-fast: false
matrix:
include:
- name: linux-amd64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: ring-cli

- name: win-amd64
runner: windows-latest
target: x86_64-pc-windows-msvc
binary: ring-cli.exe

- name: macos-amd64
runner: macos-latest
target: x86_64-apple-darwin
binary: ring-cli

- name: macos-arm64
runner: macos-latest
target: aarch64-apple-darwin
binary: ring-cli

steps:
- uses: actions/checkout@v4

- name: Setup Rust
run: rustup toolchain install stable --profile minimal --target ${{ matrix.target }}

- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Build executable
run: cargo build --release --bin ring-cli --target ${{ matrix.target }}

- name: Rename binary
id: rename
shell: bash
run: |
binary="${{ startsWith(matrix.name, 'win') && 'ring-cli.exe' || 'ring-cli' }}"
result="${{ format(startsWith(matrix.name, 'win') && 'ring-{0}.exe' || 'ring-{0}', matrix.name) }}"
mv "target/${{ matrix.target }}/release/$binary" $result
echo "binary=$result" >> $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.name }}
path: ${{ steps.rename.outputs.binary }}
if-no-files-found: 'error'

release-notes:
name: Release notes
runs-on: ubuntu-latest
needs: [build]

permissions:
contents: write

steps:
- name: Read tag
id: info
run: |
tag=`echo '${{ github.ref }}' | cut -d / -f 3-`
echo version=`echo $tag | cut -d _ -f 2` >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v4

- name: Release
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.info.outputs.version }}
draft: true
generate_release_notes: true
files: |
build-linux-amd64/ring-linux-amd64
build-win-amd64/ring-win-amd64.exe
build-macos-amd64/ring-macos-amd64
build-macos-arm64/ring-macos-arm64

0 comments on commit 8e493ef

Please sign in to comment.