Skip to content

Commit fa0021c

Browse files
committed
ci: create draft release on tag
1 parent e58f1e2 commit fa0021c

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/build.yml

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

0 commit comments

Comments
 (0)