forked from RedHatter/Graveyard
-
Notifications
You must be signed in to change notification settings - Fork 4
53 lines (51 loc) · 2.38 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Build+Release on Push/PR
on:
push:
branches: [ batstyx ]
pull_request:
branches: [ master ]
workflow_dispatch:
env:
PROJECT: ${{ 'Graveyard' }}
jobs:
build-and-release:
runs-on: windows-latest
steps:
- uses: actions/[email protected] # https://github.com/marketplace/actions/checkout
- name: Get Head Commit Message
id: get_head_commit
shell: pwsh
run: |
$Message = git log --format=%B -n 1 HEAD
Write-Output "title=$($Message | Select -First 1)" >> $Env:GITHUB_OUTPUT
Write-Output "body=$($Message | Select -Skip 1)" >> $Env:GITHUB_OUTPUT
$Message | Out-File Release.md
- uses: microsoft/[email protected] # https://github.com/marketplace/actions/setup-msbuild
- uses: NuGet/[email protected] # https://github.com/marketplace/actions/setup-nuget-exe-for-use-with-actions
- run: .\scripts\update-libraries.ps1
- run: nuget restore "${{ env.PROJECT }}.sln"
- id: set_version
run: |
$build = 3000 + $Env:GITHUB_RUN_NUMBER
$buildVersion = .\scripts\assembly-version.ps1 -project "${{ env.PROJECT }}" -build $build -overrideVersion ${{ github.ref }}
echo "buildVersion=$buildVersion" >> $env:GITHUB_OUTPUT
# https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
# https://stackoverflow.com/a/74377542/146360
- run: msbuild.exe "${{ env.PROJECT }}.sln" /p:platform="x86" /p:configuration="Release"
- id: create_zip
run: |
$zipName = "${{ env.PROJECT }}-v${{ steps.set_version.outputs.buildVersion }}.zip"
7z a $zipName .\${{ env.PROJECT }}\bin\x86\Release\${{ env.PROJECT }}.dll .\${{ env.PROJECT }}\bin\x86\Release\*-*
echo "zipName=$zipName" >> $env:GITHUB_OUTPUT
- uses: ncipollo/[email protected] # https://github.com/marketplace/actions/create-release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: "${{ steps.set_version.outputs.buildVersion }}: ${{ steps.get_head_commit.outputs.title }}"
bodyFile: Release.md
tag: v${{ steps.set_version.outputs.buildVersion }}
draft: false
prerelease: true
artifacts: "${{ steps.create_zip.outputs.zipName }}"
artifactContentType: "application/zip"