Skip to content

Commit 7b82605

Browse files
committed
ci: create draft release on tag
1 parent 2ffb9f1 commit 7b82605

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

.github/workflows/build.yml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,52 @@ jobs:
6161
uses: actions/upload-artifact@v4
6262
with:
6363
name: ModApi.Updater-${{ env.GIT_REVISION }}
64-
path: Updater/ModApi.Updater/bin/Release/*.exe
64+
path: |
65+
Updater/ModApi.Updater/bin/Release/*.exe
66+
Updater/ModApi.Updater/bin/Release/update.info
67+
create-draft-release:
68+
runs-on: windows-2022
69+
needs: [ build ]
70+
if: github.ref_type == 'tag'
71+
steps:
72+
- uses: actions/checkout@v4
73+
with:
74+
fetch-depth: 0
75+
- name: Prepare Environment
76+
run: |
77+
$env:revision = git describe --tags --always
78+
echo "GIT_REVISION=$env:revision" >> $env:GITHUB_ENV
79+
- name: Download ModApi.InterimSetup
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: ModApi.InterimSetup-${{ env.GIT_REVISION }}
83+
path: artifact
84+
- name: Download ModApi.Updater
85+
uses: actions/download-artifact@v4
86+
with:
87+
name: ModApi.Updater-${{ env.GIT_REVISION }}
88+
path: artifact
89+
- name: Generate update.info
90+
run: |
91+
$updaterVersion = "1.0.0.0"
92+
$version = (($env:GIT_REVISION -split '\.')[0] -split 'v')[1] + "." `
93+
+ (($env:GIT_REVISION -split '\.')[1]) + "." `
94+
+ (($env:GIT_REVISION -split '\.')[2] -split '-')[0] + ".0"
95+
$downloadUrl = $env:GITHUB_SERVER_URL + "/" + $env:GITHUB_REPOSITORY `
96+
+ "/releases/latest/download/ModAPIUpdateSetup.exe"
6597
98+
echo $updaterVersion > update.info
99+
echo $version >> update.info
100+
echo "false" >> update.info
101+
echo $downloadUrl >> update.info
102+
103+
Copy update.info artifact/update.info
104+
- name: Create Draft Release
105+
uses: ncipollo/release-action@v1
106+
with:
107+
draft: true
108+
makeLatest: true
109+
tag: ${{ env.GIT_REVISION }}
110+
artifacts: |
111+
artifact/*
66112

0 commit comments

Comments
 (0)