-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (91 loc) · 4.05 KB
/
release.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Based on the workflow of ACRE (https://github.com/IDI-Systems/acre2/blob/master/.github/workflows/release.yml)
name: Release
on:
push:
branches:
- release
jobs:
build:
if: github.repository == 'Metis-Team/mts_presentation' && ! contains(github.event.head_commit.message, '[ci skip]')
runs-on: windows-latest
outputs:
MOD_NAME: ${{ env.MOD_NAME }}
VERSION: ${{ env.VERSION }}
VERSION_SHORT: ${{ env.VERSION_SHORT }}
SHA_SHORT: ${{ env.SHA_SHORT }}
steps:
- name: Checkout the source code
uses: actions/checkout@v4
- name: Setup HEMTT
uses: arma-actions/hemtt@main
- name: Setup Tools
run: |
C:\msys64\usr\bin\wget.exe ${{ secrets.FTP_SERVER }}/arma_tools.zip --user ${{ secrets.FTP_USERNAME }} --password ${{ secrets.FTP_PASSWORD }} -q
Expand-Archive arma_tools.zip -DestinationPath ci
echo "Check Binarize: $(Test-Path .\\ci\\binarize\\binarize_x64.exe)"
hemtt --version
echo "Install Binarize dependencies"
cp .\ci\binarize\X3DAudio1_7.dll,.\ci\binarize\XAPOFX1_5.dll C:\Windows\System32\
echo "::group::Set Binarize registry path"
New-Item "HKCU:\\Software\\Bohemia Interactive\\binarize" -Force | New-ItemProperty -Name path -Value "${{ github.workspace }}\ci\binarize"
echo "::endgroup::"
echo "Set env variables"
echo "MOD_NAME=Metis_Presentation" >> $env:GITHUB_ENV
$version = Select-String -Path "addons\\presentation\\script_version.hpp" -Pattern '#define (MAJOR|MINOR|PATCHLVL|BUILD) (\d+)' | ForEach-Object { $_.Matches.Groups[2].Value } | Join-String -Separator "."
$version_short = (Select-String -InputObject $version -Pattern '^\d+\.\d+\.\d+').Matches.Value
echo "VERSION=$version" >> $env:GITHUB_ENV
echo "VERSION_SHORT=$version_short" >> $env:GITHUB_ENV
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $env:GITHUB_ENV
- name: Test Binarize
run: |
echo "::group::Run Binarize without arguments (look for missing DLLs)"
./ci/binarize/binarize_x64.exe || true # binarize exits with 1 if no file given
echo "::endgroup::"
shell: bash # outputs missing dll information
- name: Build (HEMTT)
run: |
echo "${{ env.MOD_NAME }} v${{ env.VERSION }} (${{ env.SHA_SHORT }})"
hemtt release --no-archive
env:
BIOUTPUT: 1 # output binarize log
- name: Rename build folder
run: mv .hemttout/release .hemttout/@${{ env.MOD_NAME }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.MOD_NAME }}
path: .hemttout/@*
retention-days: 1
include-hidden-files: true # Because .hemttout is a hidden directory
if-no-files-found: error
publish-release:
needs: build
if: github.ref == 'refs/heads/release'
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
- name: Prepare Archives
run: |
mv ${{ needs.build.outputs.MOD_NAME }}/* .
echo "::group::Archive build"
zip -r ${{ needs.build.outputs.MOD_NAME }}_${{ needs.build.outputs.VERSION_SHORT }}.zip @${{ needs.build.outputs.MOD_NAME }}
echo "::endgroup::"
- name: Prepare GitHub Release
id: release_drafter
uses: release-drafter/release-drafter@v6
with:
name: Version ${{ needs.build.outputs.VERSION_SHORT }}
tag: v${{ needs.build.outputs.VERSION }}
version: ${{ needs.build.outputs.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload mod archive to GitHub Release
uses: shogo82148/[email protected]
with:
upload_url: ${{ steps.release_drafter.outputs.upload_url }}
asset_path: ./${{ needs.build.outputs.MOD_NAME }}_${{ needs.build.outputs.VERSION_SHORT }}.zip
asset_name: ${{ needs.build.outputs.MOD_NAME }}_${{ needs.build.outputs.VERSION_SHORT }}.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}