Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmacha committed Jun 1, 2024
1 parent afcbffb commit 5903754
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Build

on:
push:
workflow_dispatch:
inputs:
version:
description: 'Build version'
required: true
default: ''

jobs:
build:
Expand Down Expand Up @@ -32,6 +39,7 @@ jobs:
env:
OS: ${{ matrix.os }}
MSVC_VERSION: ${{ matrix.toolkit }}
VERSION: ${{ inputs.version }}
run: |
$TOOLKIT=""
echo "MSVC_VERSION = $env:MSVC_VERSION"
Expand All @@ -48,7 +56,12 @@ jobs:
$date = Get-Date -Format 'yyyy.MM.ddTHH.mm'
Set-Content -Path out/install/x86-multi-config/build-time.txt -Value $date
$os = $env:OS
$filename = "UnionAPI-$TOOLKIT-$os-$date.zip"
$version = $env:VERSION
if ($version -eq '') {
$filename = "UnionAPI-$TOOLKIT-$os-$date.zip"
} else {
$filename = "UnionAPI-$TOOLKIT-$os-$version.zip"
}
echo "filename=$filename" >> $env:GITHUB_OUTPUT
Compress-Archive out/install/x86-multi-config/* out/publish/$filename
$hash = Get-FileHash -Path out/publish/$filename -Algorithm SHA256
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Release
permissions: write-all

on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true

jobs:
build:
uses: ./.github/workflows/build.yml
with:
version: ${{ inputs.version }}
publish:
runs-on: windows-2022
needs: build
steps:
- name: Download artifact (v142)
uses: actions/download-artifact@v4
with:
name: UnionAPI-v142-windows-2022-${{ inputs.version }}.zip
path: .
- name: Download artifact (v143)
uses: actions/download-artifact@v4
with:
name: UnionAPI-v143-windows-2022-${{ inputs.version }}.zip
path: .
- name: Prepare Release Files
run: |
function GenerateReleaseNotes {
param (
[string]$Build,
[string]$Notes
)
Uncompress-Archive -Path $Build-${{ inputs.version }}.zip -DestinationPath $Build-${{ inputs.version }}
$Notes += "# UnionAPI (MSVC v142)`n`n"
$sha256 = Get-Content -Path $Build-${{ inputs.version }}.zip.sha256
$Notes += "Archive SHA256: $sha256`n`n"
$buildTime = Get-Content -Path $Build-${{ inputs.version }}/build-time.txt
$Notes += "Build Time: $buildTime`n`n"
$unionApiRef = Get-Content -Path $Build-${{ inputs.version }}/union-api.ref.txt
$Notes += "Union API: [$unionApiRef](https://gitlab.com/union-framework/union-api/-/tree/$unionApiRef)`n`n"
$gothicApiRef = Get-Content -Path $Build-${{ inputs.version }}/gothic-api.ref.txt
$Notes += "Union API: [$gothicApiRef](https://gitlab.com/union-framework/gohtic-api/-/tree/$gothicApiRef)`n`n"
$configurations = Get-ChildItem -Path $Build-${{ inputs.version }}/bin -Directory | Select-Object -ExpandProperty Name
$Notes += "Configurations:`n`n"
foreach ($configuration in $configurations) {
$Notes += "- $configuration`n"
}
$Notes += "`n"
return $Notes;
}
$notes = GenerateReleaseNotes -Build UnionAPI-v142-windows-2022 -Notes ""
$notes = GenerateReleaseNotes -Build UnionAPI-v143-windows-2022 -Notes $notes
Set-Content -Path release-notes.md -Value $notes
- name: Release
uses: softprops/action-gh-release@v2
with:
token: ${{ github.token }}
generate_release_notes: false
body_path: release-notes.md
fail_on_unmatched_files: true
draft: false
make_latest: true
name: ${{ inputs.version }}}
files: |
UnionAPI-v142-windows-2022-${{ inputs.version }}.zip
UnionAPI-v142-windows-2022-${{ inputs.version }}.zip.sha256
UnionAPI-v143-windows-2022-${{ inputs.version }}.zip
UnionAPI-v143-windows-2022-${{ inputs.version }}.zip.sha256

0 comments on commit 5903754

Please sign in to comment.