name: GitHub release
on:
workflow_dispatch
env:
CACHE_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
jobs:
get-build-info:
runs-on: ubuntu-latest
outputs:
new-ezno-version: ${{ steps.get-version.outputs.new-ezno-version }}
sponsors: ${{ steps.get-sponsors.outputs.sponsors }}
steps:
- name: Get version
id: get-version
run: |
version=$(git tag --list 'release/main-*' --sort=-taggerdate | tail -n 1)
echo "Releasing ${version:13}"
echo "new-ezno-version=${version:13}" >> $GITHUB_OUTPUT
- id: get-sponsors
run: |
SPONSORS=$(gh api graphql -f query='{
user(login: "kaleidawave") {
sponsorshipsAsMaintainer(first: 100, activeOnly: false) {
edges {
node {
sponsor {
login
}
}
}
}
}
}' -q '.data.user.sponsorshipsAsMaintainer.edges | map(.node.sponsor.login) | join(", ")')
echo "sponsors=$SPONSORS" >> $GITHUB_OUTPUT
shell: bash
env:
GH_TOKEN: ${{ github.token }}
build:
needs: [get-build-info]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
include:
- os: windows-latest
executable-extension: .exe
platform_name: x86_64-pc-windows
- os: ubuntu-latest
platform_name: x86_64-unknown-linux
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build binary
run: cargo build --release
- name: Rename and move release assets
run: |
mkdir artifacts
export ${{ needs.get-build-info.outputs.sponsors }}
mv target/release/ezno${{ matrix.executable-extension }} artifacts/ezno-${{ needs.get-build-info.outputs.new-ezno-version }}-${{ matrix.platform_name }}${{ matrix.executable-extension }}
- uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: artifacts/*
if-no-files-found: error
retention-days: 1
github-release:
needs: [build, get-build-info]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: build-artifacts
path: build-artifacts
- name: Print artifacts
run: |
echo "::group::Print Artifacts"
ls -R build-artifacts
echo "::endgroup::"
- name: GitHub release
uses: softprops/action-gh-release@v1
with:
name: "Ezno ${{ needs.get-build-info.outputs.new-ezno-version }}"
tag_name: "release/ezno-${{ needs.get-build-info.outputs.new-ezno-version }}"
body: "For @kaleidawave to update"
files: |
README.md
build-artifacts/*