Release #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Semantic Version, numeric only (1.2.3 or 1.2.3-4)' | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: write | |
steps: | |
- name: Get version from input | |
# https://semver.org | |
id: tag_name | |
shell: pwsh | |
env: | |
INPUT_VERSION: ${{ github.event.inputs.version }} | |
run: | | |
$current_semver = $env:INPUT_VERSION.StartsWith('v') ? $env:INPUT_VERSION.Substring(1) : $env:INPUT_VERSION | |
$current_dotnetver = $current_semver.Replace('-','.') | |
echo "current_semver=$current_semver" >> $env:GITHUB_OUTPUT | |
echo "current_dotnetver=$current_dotnetver" >> $env:GITHUB_OUTPUT | |
- uses: actions/checkout@v3 | |
- name: Print Debug Info | |
run: dotnet --info | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Pack | |
# https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#packrelease | |
env: | |
DOTNET_CLI_ENABLE_PACK_RELEASE_FOR_SOLUTIONS: true | |
run: dotnet pack -c Release --no-restore -p:Version="${{ steps.tag_name.outputs.current_dotnetver }}" -p:RepositoryBranch=${{ github.ref_name }} -p:RepositoryCommit="${{ github.sha }}" | |
- name: Get Changelog Entry | |
id: changelog_reader | |
uses: mindsers/changelog-reader-action@v2.2.2 | |
with: | |
validation_level: warn | |
version: ${{ steps.tag_name.outputs.current_semver }} | |
path: ./CHANGELOG.md | |
- name: Push to NuGet | |
run: dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
- name: Push to GitHub Packages | |
run: dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/Nutzzz/index.json | |
- name: Download artifact (Linux) | |
id: download-artifact-linux | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
workflow: .github/workflows/ci.yml | |
branch: main | |
name: GameFinder\.Example-Linux-.* | |
name_is_regexp: true | |
path: Linux | |
if_no_artifact_found: warn | |
- name: Download artifact (Windows) | |
id: download-artifact-windows | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
workflow: .github/workflows/ci.yml | |
branch: main | |
name: GameFinder\.Example-Windows-.* | |
name_is_regexp: true | |
path: Windows | |
if_no_artifact_found: warn | |
- name: Download artifact (macOS) | |
id: download-artifact-macos | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
workflow: .github/workflows/ci.yml | |
branch: main | |
name: GameFinder\.Example-macOS-.* | |
name_is_regexp: true | |
path: macOS | |
if_no_artifact_found: warn | |
- name: Append .app to macOS binary | |
run: mv "/macOS/GameCollector" "/macOS/GameCollector.app" | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.tag_name.outputs.current_dotnetver }} | |
name: Release ${{ steps.changelog_reader.outputs.version }} | |
# TODO: Get prior version to prepend to body: | |
#**Full Changelog**: https://github.com/Nutzzz/GameCollector/compare/v1.2.3.3...v1.2.3.4 | |
body: ${{ steps.changelog_reader.outputs.changes }} | |
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }} | |
#prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }} | |
files: | | |
Linux/GameCollector | |
Windows/GameCollector.exe | |
macOS/GameCollector.app |