Skip to content

Release v0.7.1

Release v0.7.1 #36

Workflow file for this run

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
target:
description: "The git ref to base the release on (eg: '1957a8e7', default: current head of the branch the workflow is run on)"
required: false
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 }}
TargetSha: ${{ steps.setOutputs.outputs.target }}
ProjectFile: ${{ steps.setOutputs.outputs.projectFile }}
steps:
- name: Set Outputs
id: setOutputs
shell: pwsh
env:
InputVersion: ${{ inputs.version }}
InputTarget: ${{ inputs.target }}
HeadSha: ${{ github.sha }}
run: |
$tagVersion = $env:InputVersion.StartsWith('v') ? $env:InputVersion : "v" + $env:InputVersion
$rawVersion = $tagVersion.Substring(1)
$target = $env:InputTarget ? $env:InputTarget : $env:HeadSha
$validation = [System.Version]::Parse($rawVersion)
echo "tagVersion=$tagVersion" >> $env:GITHUB_OUTPUT
echo "rawVersion=$rawVersion" >> $env:GITHUB_OUTPUT
echo "target=$target" >> $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 }}
Target: ${{ needs.transformInputs.outputs.TargetSha }}
# 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 }}
Target: ${{ needs.transformInputs.outputs.TargetSha }}
# 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@v2
with:
name: ${{ needs.transformInputs.outputs.RawVersion }}
tag_name: ${{ needs.transformInputs.outputs.TagVersion }}
target_commitish: ${{ needs.transformInputs.outputs.TargetSha }}
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/[email protected]
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