2024-03-04 20:18:49 +00:00
|
|
|
name: Release
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
jobs:
|
2024-03-28 12:47:52 +00:00
|
|
|
# Better to check first, runners other than ubuntu-latest take up more free minutes
|
|
|
|
check:
|
|
|
|
name: Check
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Check
|
|
|
|
run: cargo check --all-features --locked
|
|
|
|
|
2024-03-04 20:18:49 +00:00
|
|
|
build:
|
2024-03-28 12:47:52 +00:00
|
|
|
needs: [check]
|
2024-03-04 20:18:49 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
host: linux
|
2024-03-28 12:47:52 +00:00
|
|
|
arch: x86_64
|
2024-03-04 20:18:49 +00:00
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
|
|
|
|
- os: windows-latest
|
|
|
|
host: windows
|
2024-03-28 12:47:52 +00:00
|
|
|
arch: x86_64
|
2024-03-04 20:18:49 +00:00
|
|
|
target: x86_64-pc-windows-msvc
|
|
|
|
|
2024-05-12 12:15:51 +01:00
|
|
|
- os: macos-13
|
2024-03-04 20:18:49 +00:00
|
|
|
host: macos
|
2024-03-28 12:47:52 +00:00
|
|
|
arch: x86_64
|
2024-03-04 20:18:49 +00:00
|
|
|
target: x86_64-apple-darwin
|
|
|
|
|
2024-05-12 12:15:51 +01:00
|
|
|
- os: macos-latest
|
|
|
|
host: macos
|
|
|
|
arch: aarch64
|
|
|
|
target: aarch64-apple-darwin
|
2024-03-04 20:18:49 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2024-03-28 12:47:52 +00:00
|
|
|
name: Build for ${{ matrix.host }}-${{ matrix.arch }}
|
2024-03-04 20:18:49 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set env
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
BIN_NAME=pesde
|
2024-03-28 12:47:52 +00:00
|
|
|
ARCHIVE_NAME=$BIN_NAME-$(echo ${{ github.ref_name }} | cut -c 2-)-${{ matrix.host }}-${{ matrix.arch }}.zip
|
2024-03-04 20:18:49 +00:00
|
|
|
|
|
|
|
echo "BIN_NAME=$BIN_NAME" >> $GITHUB_ENV
|
|
|
|
echo "ARCHIVE_NAME=$ARCHIVE_NAME" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: cargo build --bins --all-features --release --target ${{ matrix.target }} --locked
|
|
|
|
|
|
|
|
- name: Archive
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if [ ${{ matrix.host }} = "windows" ]; then
|
|
|
|
cp target/${{ matrix.target }}/release/${{ env.BIN_NAME }}.exe ${{ env.BIN_NAME }}.exe
|
|
|
|
7z a ${{ env.ARCHIVE_NAME }} ${{ env.BIN_NAME }}.exe
|
|
|
|
else
|
|
|
|
cp target/${{ matrix.target }}/release/${{ env.BIN_NAME }} ${{ env.BIN_NAME }}
|
|
|
|
zip -r ${{ env.ARCHIVE_NAME }} ${{ env.BIN_NAME }}
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Upload assets
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: ${{ env.ARCHIVE_NAME }}
|
|
|
|
path: ${{ env.ARCHIVE_NAME }}
|
|
|
|
|
2024-03-28 12:47:52 +00:00
|
|
|
publish:
|
|
|
|
name: Publish to crates.io
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [build]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Publish
|
|
|
|
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty --locked
|
|
|
|
|
2024-03-04 20:18:49 +00:00
|
|
|
create_release:
|
|
|
|
name: Create Release
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
pull-requests: read
|
2024-03-28 12:47:52 +00:00
|
|
|
needs: [build, publish]
|
2024-03-04 20:18:49 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/download-artifact@v4
|
|
|
|
with:
|
|
|
|
path: artifacts
|
|
|
|
merge-multiple: true
|
|
|
|
|
|
|
|
- name: Generate a changelog
|
|
|
|
uses: orhun/git-cliff-action@v3
|
|
|
|
id: git-cliff
|
|
|
|
with:
|
|
|
|
config: cliff.toml
|
2024-03-06 20:23:38 +00:00
|
|
|
args: --verbose --current --strip header
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
GITHUB_REPO: ${{ github.repository }}
|
2024-03-04 20:18:49 +00:00
|
|
|
|
|
|
|
- name: Create Release
|
|
|
|
id: create_release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
tag_name: ${{ github.ref_name }}
|
|
|
|
name: ${{ github.ref_name }}
|
|
|
|
body: ${{ steps.git-cliff.outputs.content }}
|
|
|
|
draft: true
|
|
|
|
prerelease: false
|
2024-03-28 12:47:52 +00:00
|
|
|
files: artifacts/*
|