Skip to content

feat: first commit

feat: first commit #1

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: rocas
asset_name: rocas-linux
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: rocas
asset_name: rocas-macos
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: rocas.exe
asset_name: rocas.exe
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ matrix.os }}-cargo-
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Rename binary (Unix)
if: matrix.os != 'windows-latest'
run: cp target/${{ matrix.target }}/release/${{ matrix.artifact_name }} ${{ matrix.asset_name }}
- name: Rename binary (Windows)
if: matrix.os == 'windows-latest'
run: copy target\${{ matrix.target }}\release\${{ matrix.artifact_name }} ${{ matrix.asset_name }}
shell: cmd
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.asset_name }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Display artifacts
run: ls -la artifacts/
- name: Extract changelog for this version
id: changelog
run: |
TAG=${GITHUB_REF#refs/tags/}
# Extracts the section between this tag and the previous one in CHANGELOG.md
# Falls back to a generic message if no CHANGELOG.md exists
if [ -f CHANGELOG.md ]; then
NOTES=$(awk "/^## \[?${TAG}\]?/{found=1; next} found && /^## /{exit} found{print}" CHANGELOG.md)
else
NOTES="Release ${TAG}"
fi
echo "notes<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.notes }}
draft: false
prerelease: ${{ contains(github.ref_name, '-') }} # v1.0.0-beta counts as prerelease
files: |
artifacts/rocas-linux
artifacts/rocas-macos
artifacts/rocas.exe