Skip to content

Commit 9f608b0

Browse files
authored
Merge pull request #20 from Assumeru/releases
Generate releases from tags
2 parents b97f296 + 4e1d441 commit 9f608b0

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

.github/workflows/build.yaml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,32 @@ jobs:
206206

207207
runs-on: ubuntu-latest
208208

209+
env:
210+
file: TEST
211+
209212
steps:
210213
- uses: actions/checkout@v4
211214

212215
- name: Download all artifacts
213216
uses: actions/download-artifact@v4
214217

218+
- name: Set file name
219+
if: startsWith(github.ref, 'refs/tags/')
220+
run: echo "file=${{ github.ref_name }}" >> "$GITHUB_ENV"
221+
222+
- name: Rename artifacts
223+
run: |
224+
mv vcpkg-x64-*-${{ github.sha }}/vcpkg-x64-windows-2019-${{ github.sha }}.7z vcpkg-x64-windows-2019-${{ env.file }}.7z
225+
mv vcpkg-x64-*-${{ github.sha }}/vcpkg-x64-windows-2022-${{ github.sha }}.7z vcpkg-x64-windows-2022-${{ env.file }}.7z
226+
mv vcpkg-x64-*-${{ github.sha }}/vcpkg-x64-windows-2019-pdb-${{ github.sha }}.7z vcpkg-x64-windows-2019-pdb-${{ env.file }}.7z
227+
mv vcpkg-x64-*-${{ github.sha }}/vcpkg-x64-windows-2022-pdb-${{ github.sha }}.7z vcpkg-x64-windows-2022-pdb-${{ env.file }}.7z
228+
229+
- name: Release
230+
if: startsWith(github.ref, 'refs/tags/')
231+
uses: softprops/action-gh-release@v2
232+
with:
233+
files: vcpkg-x64-windows-*-${{ env.file }}.7z
234+
215235
- name: Setup ssh-agent
216236
env:
217237
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
@@ -266,39 +286,44 @@ jobs:
266286
if: ${{ env.SSH_PRIVATE_KEY == '' }}
267287
run: git clone https://gitlab.com/OpenMW/openmw-deps.git
268288

269-
- name: Move exported vcpkg packages and pdb files archive to openmw-deps repository
270-
run: mv vcpkg-x64-*-${{ github.sha }}/vcpkg-x64-*-${{ github.sha }}.7z openmw-deps/windows/
289+
- name: Generate files containing a download url and hash
290+
run: |
291+
for file in vcpkg-x64-windows-*-${{ env.file }}.7z; do
292+
filename=`echo "$file" | sed -r 's/vcpkg-x64-windows-(.+)-${{ env.file }}.7z/vcpkg-x64-\1-${{ env.file }}.txt/'`
293+
echo "${{ github.server_url }}/${{ github.repository }}/releases/download/${{ env.file }}/$file" > "openmw-deps/windows/$filename"
294+
shasum -a 512 "$file" >> "openmw-deps/windows/$filename"
295+
done
271296
272297
- name: Generate commit message
273298
env:
274299
GH_TOKEN: ${{ github.token }}
275300
working-directory: ${{ github.workspace }}/openmw-deps
276301
run: |
277-
echo Add vcpkg packages built at ${{ github.sha }} > commit_message.txt
302+
echo Add vcpkg package urls built at ${{ github.sha }} > commit_message.txt
278303
echo >> commit_message.txt
279304
printf 'Pushed by ' >> commit_message.txt
280305
url=$(gh run --repo ${{ github.repository }} view ${{ github.run_id }} --json jobs --jq '.jobs[] | select(.name == "push-dynamic") | .url')
281306
echo "${url:?}" >> commit_message.txt
282307
echo >> commit_message.txt
283308
284-
- name: Commit exported vcpkg packages
309+
- name: Commit generated metadata
285310
working-directory: ${{ github.workspace }}/openmw-deps
286311
run: |
287-
git checkout -b vcpkg-x64-${{ github.sha }}
288-
git add windows/vcpkg-x64-*-${{ github.sha }}.7z
312+
git checkout -b vcpkg-x64-windows-${{ github.sha }}
313+
git add windows/vcpkg-x64-*-${{ env.file }}.txt
289314
git commit -F commit_message.txt
290315
291316
- name: Verify commit to openmw-deps repository
292317
if: ${{ steps.import_gpg.outputs.fingerprint != '' }}
293318
working-directory: ${{ github.workspace }}/openmw-deps
294319
run: git verify-commit HEAD
295320

296-
- name: Push exported vcpkg packages to gitlab
321+
- name: Push generated metadata to gitlab
297322
env:
298323
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
299324
# Make sure only signed commits are pushed
300325
if: ${{ vars.PUSH_URL != '' && env.SSH_PRIVATE_KEY != '' && steps.import_gpg.outputs.fingerprint != '' }}
301326
working-directory: ${{ github.workspace }}/openmw-deps
302327
run: |
303328
git remote set-url --push origin "${{ vars.PUSH_URL }}"
304-
git push origin vcpkg-x64-${{ github.sha }}
329+
git push origin vcpkg-x64-windows-${{ github.sha }}

0 commit comments

Comments
 (0)