Skip to content

Release v0.0.7

Release v0.0.7 #7

Workflow file for this run

name: Release
on:
pull_request:
types: [closed]
branches: [main]
workflow_dispatch:
permissions:
contents: write
jobs:
create-tag:
name: Create Tag
runs-on: ubuntu-latest
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release'))
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract version from Directory.Build.props
id: version
run: |
version=$(grep -oP '<Version>\K\d+\.\d+\.\d+' Directory.Build.props)
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Delete existing release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete "v${{ steps.version.outputs.version }}" \
--repo "${{ github.repository }}" --yes || true
- name: Delete existing tag
run: |
git push origin --delete "v${{ steps.version.outputs.version }}" || true
- name: Create tag
run: |
git tag "v${{ steps.version.outputs.version }}"
git push origin "v${{ steps.version.outputs.version }}"
build:
name: Build single-file binary (${{ matrix.rid }})
needs: create-tag
strategy:
fail-fast: false
matrix:
include:
- rid: win-x64
os: windows-latest
ext: .exe
asset_suffix: windows_x64
- rid: win-arm64
os: windows-latest
ext: .exe
asset_suffix: windows_arm64
- rid: linux-x64
os: ubuntu-latest
ext: ""
asset_suffix: linux_x64
- rid: osx-arm64
os: macos-latest
ext: ""
asset_suffix: macos_arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.x'
- name: Restore
run: dotnet restore
- name: Publish single-file binary
run: >
dotnet publish src/PapersCli.Cli/PapersCli.Cli.csproj
--configuration Release
--runtime ${{ matrix.rid }}
--self-contained true
--output publish/
-p:PublishAot=false
-p:PublishSingleFile=true
-p:IncludeNativeLibrariesForSelfExtract=true
- name: Rename binary (Windows)
if: runner.os == 'Windows'
run: |
mv publish/papers-cli.exe "publish/papers-cli_${{ matrix.asset_suffix }}.exe"
- name: Rename binary (Unix)
if: runner.os != 'Windows'
run: |
mv publish/papers-cli "publish/papers-cli_${{ matrix.asset_suffix }}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: papers-cli-${{ matrix.rid }}
path: publish/papers-cli_${{ matrix.asset_suffix }}${{ matrix.ext }}
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [create-tag, build]
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ needs.create-tag.outputs.version }}" \
artifacts/papers-cli_windows_x64.exe \
artifacts/papers-cli_windows_arm64.exe \
artifacts/papers-cli_linux_x64 \
artifacts/papers-cli_macos_arm64 \
--repo "${{ github.repository }}" \
--title "v${{ needs.create-tag.outputs.version }}" \
--generate-notes