Create new release #163
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: Create new release | |
on: | |
workflow_dispatch: | |
inputs: | |
release_note_smallnote: | |
type: string | |
description: Small note above download button | |
required: false | |
release_note_download: | |
type: boolean | |
description: Show download button | |
required: true | |
default: true | |
release_note_changelog: | |
type: boolean | |
description: Show changelog | |
required: true | |
default: true | |
release_note_compare: | |
type: boolean | |
description: Show compare link | |
required: true | |
default: true | |
kokkoro_message: | |
type: tring | |
description: Kokkoro's Message | |
required: false | |
default: Aruji-sama, look like there is a new update dropped, why don't we check it out? | |
test_mode: | |
type: boolean | |
description: Test mode | |
required: true | |
default: false | |
defaults: | |
run: | |
shell: pwsh | |
jobs: | |
build: | |
name: Windows release | |
runs-on: windows-latest | |
outputs: | |
changes: ${{ steps.changes.outputs.discord_changes }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Preparing | |
run: | | |
& .\.github\scripts\initialize.ps1 | |
- name: Add small note | |
if: inputs.release_note_smallnote | |
run: | | |
"${{ inputs.release_note_smallnote }}" >> "./RELEASE_NOTE" | |
- name: Create download button | |
if: inputs.release_note_download | |
run: | | |
#"`r`n# Download`r`n" >> "./RELEASE_NOTE" | |
#"Choose a version:`r`n" >> "./RELEASE_NOTE" | |
"|[Download](https://github.com/ImaterialC/PriconneRe-TL/releases/download/${{ env.RELEASE_TAG }}/PriconneTL_${{ env.RELEASE_TAG }}.zip)|`r`n|-|" >> "./RELEASE_NOTE" | |
Write-Output "::group::Release Note" | |
Get-Content -Raw "./RELEASE_NOTE" | |
Write-Output "::endgroup::" | |
- name: Generating changelog | |
if: inputs.release_note_changelog | |
run: | | |
& .\.github\scripts\make_changelog.ps1 | |
- name: Generating changelog in Discord format | |
id: changes | |
run: | | |
& .\.github\scripts\make_announce.ps1 | |
- name: Create compare link | |
if: inputs.release_note_compare | |
run: | | |
"`r`n`r`n**Full Changelog:** https://github.com/ImaterialC/PriconneRe-TL/compare/${{ env.PREVIOUS_TAG }}...${{ env.RELEASE_TAG }}" >> ./RELEASE_NOTE | |
- name: Generating artifact | |
run: | | |
$Version = Get-Content "src/BepInEx/Translation/en/Text/Version.txt" | |
Set-Content -Path "src/BepInEx/Translation/en/Text/Version.txt" -Value $Version.Replace("Pre-release", "${{ env.RELEASE_TAG }}") | |
Write-Output "Generated Version file" | |
Compress-Archive -Path "src/*" -DestinationPath 'PriconneTL_${{ env.RELEASE_TAG }}.zip' | |
Get-Item "PriconneTL_${{ env.RELEASE_TAG }}.zip" -ErrorAction Stop | |
- name: Publish Release | |
if: inputs.test_mode == false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create ` | |
--latest ` | |
--notes-file RELEASE_NOTE ` | |
--title "${{ env.RELEASE_TITLE }}"` | |
${{ env.RELEASE_TAG }} ` | |
PriconneTL_${{ env.RELEASE_TAG }}.zip ` | |
announce: | |
name: Discord Announcement | |
if: inputs.test_mode == false | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Announcing new release | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@0c4b27844ba47cb1c7bee539c8eead5284ce9fa9 | |
with: | |
args: "<@&1082514350700515348> ${{ inputs.kokkoro_message }} \n${{ needs.build.outputs.changes }}\n" |