Release v0.6.1 #30
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 | |
run-name: Release ${{ inputs.version }} | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "The version to release (eg: 'v1.0.0')" | |
required: true | |
type: string | |
draft: | |
description: "Create a draft release?" | |
required: false | |
type: boolean | |
default: true | |
prerelease: | |
description: "Create a prerelease?" | |
required: false | |
type: boolean | |
default: true | |
release-nexus-mods: | |
description: "Release on Nexus Mods?" | |
required: false | |
type: boolean | |
default: false | |
notify-discord: | |
description: "Notify on Discord?" | |
required: false | |
type: boolean | |
default: false | |
notify-slack: | |
description: "Notify on Slack?" | |
required: false | |
type: boolean | |
default: false | |
env: | |
ProjectFile: "src/NexusMods.App/NexusMods.App.csproj" | |
jobs: | |
transformInputs: | |
runs-on: ubuntu-latest | |
outputs: | |
TagVersion: ${{ steps.setOutputs.outputs.tagVersion }} | |
RawVersion: ${{ steps.setOutputs.outputs.rawVersion }} | |
ProjectFile: ${{ steps.setOutputs.outputs.projectFile }} | |
steps: | |
- name: Set Outputs | |
id: setOutputs | |
shell: pwsh | |
env: | |
InputVersion: ${{ inputs.version }} | |
run: | | |
$tagVersion = $env:InputVersion.StartsWith('v') ? $env:InputVersion : "v" + $env:InputVersion | |
$rawVersion = $env:InputVersion.StartsWith('v') ? $env:InputVersion.Substring(1) : $env:InputVersion | |
$validation = [System.Version]::Parse($rawVersion) | |
echo "tagVersion=$tagVersion" >> $env:GITHUB_OUTPUT | |
echo "rawVersion=$rawVersion" >> $env:GITHUB_OUTPUT | |
echo "projectFile=${{ env.ProjectFile }}" >> $env:GITHUB_OUTPUT | |
build-linux: | |
needs: [ transformInputs ] | |
uses: ./.github/workflows/build-linux-pupnet.yaml | |
with: | |
AppVersion: ${{ needs.transformInputs.outputs.RawVersion }} | |
# this is a bit of a hack, you can't use environment variables here | |
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability | |
ProjectFile: ${{ needs.transformInputs.outputs.ProjectFile }} | |
RetentionDays: 1 | |
build-windows: | |
needs: [ transformInputs ] | |
uses: ./.github/workflows/build-windows-pupnet.yaml | |
with: | |
AppVersion: ${{ needs.transformInputs.outputs.RawVersion }} | |
# this is a bit of a hack, you can't use environment variables here | |
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability | |
ProjectFile: ${{ needs.transformInputs.outputs.ProjectFile }} | |
RetentionDays: 1 | |
SignExecutable: true | |
secrets: | |
ES_USERNAME: ${{ secrets.ES_USERNAME }} | |
ES_PASSWORD: ${{ secrets.ES_PASSWORD }} | |
ES_CREDENTIAL_ID: ${{ secrets.ES_CREDENTIAL_ID }} | |
ES_TOTP_SECRET: ${{ secrets.ES_TOTP_SECRET }} | |
release-github: | |
runs-on: ubuntu-latest | |
needs: [ transformInputs, build-linux, build-windows ] | |
outputs: | |
GitHubReleaseUrl: ${{ steps.create-gh-release.outputs.url }} | |
permissions: | |
contents: write | |
discussions: write | |
steps: | |
- name: Get Linux Archive | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ needs.build-linux.outputs.ArtifactNameLinuxArchive }} | |
path: bin/LinuxArchive | |
- name: Get Linux AppImage | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ needs.build-linux.outputs.ArtifactNameLinuxAppImage }} | |
path: bin/LinuxAppImage | |
- name: Get Windows Archive | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ needs.build-windows.outputs.ArtifactNameWindowsArchive }} | |
path: bin/WindowsArchive | |
- name: Get Windows Inno Setup | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ needs.build-windows.outputs.ArtifactNameWindowsInnoSetup }} | |
path: bin/WindowsInnoSetup | |
- name: List Artifacts | |
shell: bash | |
run: tree bin | |
- name: Create Release | |
id: create-gh-release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ needs.transformInputs.outputs.RawVersion }} | |
tag_name: ${{ needs.transformInputs.outputs.TagVersion }} | |
draft: ${{ inputs.draft }} | |
prerelease: ${{ inputs.prerelease }} | |
files: bin/**/* | |
fail_on_unmatched_files: true | |
release-nexus-mods: | |
runs-on: ubuntu-latest | |
needs: [ transformInputs, build-linux, build-windows ] | |
steps: | |
- name: Empty | |
if: inputs.release-nexus-mods == true | |
run: exit 0 | |
notify-discord: | |
runs-on: ubuntu-latest | |
needs: [ release-github, release-nexus-mods ] | |
steps: | |
- name: Send Discord notification | |
if: inputs.notify-discord == true | |
uses: appleboy/discord-action@0.0.3 | |
with: | |
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }} | |
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} | |
message: "New release is available at ${{ needs.release-github.outputs.GitHubReleaseUrl }}" | |
username: "Release Bot" | |
notify-slack: | |
runs-on: ubuntu-latest | |
needs: [ release-github, release-nexus-mods ] | |
steps: | |
- name: Empty | |
if: inputs.notify-slack == true | |
run: exit 0 |