Skip to content

CI - Fix action-gh-release #28

CI - Fix action-gh-release

CI - Fix action-gh-release #28

Workflow file for this run

name: Release
on:
push:
branches:
- development-build
- release-build
workflow_dispatch:
inputs:
path:
description: 'Path of upload (after <ftp>/test/)'
required: true
default: 'acre2'
label:
description: 'Label to attach to the archive name (with leading underscore)'
jobs:
build:
if: github.repository == 'IDI-Systems/acre2' && ! contains(github.event.head_commit.message, '[ci skip]')
runs-on: windows-latest
outputs:
VERSION: ${{ env.VERSION }}
SHA_SHORT: ${{ env.SHA_SHORT }}
steps:
- name: Checkout the source code
uses: actions/checkout@v3
- name: Setup HEMTT
uses: arma-actions/hemtt@v1
- name: Setup Binarize
run: |
C:\msys64\usr\bin\wget.exe ${{ secrets.FTP_SERVER }}/tools/acre2_tools.zip --user ${{ secrets.FTP_USERNAME }} --password ${{ secrets.FTP_PASSWORD }} -q
Expand-Archive acre2_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::"
$version = Select-String -Path "addons\\main\\script_version.hpp" -Pattern '#define (MAJOR|MINOR|PATCHLVL|BUILD) (\d+)' | ForEach-Object { $_.Matches.Groups[2].Value } | Join-String -Separator "."
echo "VERSION=$version" >> $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 "ACRE2 v${{ env.VERSION }} (${{ env.SHA_SHORT }})"
hemtt release --no-archive
- name: Rename build folder
run: mv .hemttout/release .hemttout/@acre2
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: acre2
path: .hemttout/@*
retention-days: 1
compile:
if: github.repository == 'IDI-Systems/acre2' && ! contains(github.event.head_commit.message, '[ci skip]')
runs-on: windows-latest
strategy:
matrix:
arch: [x86, x64]
env:
DXSDK_DIR: "${{ github.workspace }}\\ci\\directx-sdk" # CMake FindDirectX
steps:
- name: Checkout the source code
uses: actions/checkout@v3
- name: Setup BattlEye and DirectX SDK
run: |
C:\msys64\usr\bin\wget.exe ${{ secrets.FTP_SERVER }}/tools/acre2_tools.zip --user ${{ secrets.FTP_USERNAME }} --password ${{ secrets.FTP_PASSWORD }} -q
Expand-Archive acre2_tools.zip -DestinationPath ci
echo "Check BattlEye: $(Test-Path .\\ci\\battleye\\signtool.exe,.\\ci\\battleye\\idi-systems.pfx)"
echo "Check DirectX SDK: $(Test-Path .\\ci\\directx-sdk\\Include,.\\ci\\directx-sdk\\Lib\\${{ matrix.arch }})"
echo "DXSDK_DIR: ${{ env.DXSDK_DIR }}"
- name: Add MSBuild to PATH
uses: microsoft/[email protected]
- name: Build Extensions (x86)
if: matrix.arch == 'x86'
run: |
cd extensions\\vcproj
cmake .. -A Win32
msbuild ACRE.sln /m '/t:ACRE2Arma\acre;ACRE2Arma\arma2ts;ACRE2\ACRE2Steam;ACRE2\ACRE2TS;Extras\Wav2B64' /p:Configuration=RelWithDebInfo
- name: Build Extensions (x64)
if: matrix.arch == 'x64'
run: |
cd extensions\\vcproj64
cmake .. -A x64
msbuild ACRE.sln /m '/t:ACRE2Arma\acre;ACRE2Arma\arma2ts;ACRE2\ACRE2Steam;ACRE2\ACRE2TS' /p:Configuration=RelWithDebInfo
- name: Sign (BattlEye)
run: |
.\ci\battleye\signtool.exe sign /f .\ci\battleye\idi-systems.pfx /p ${{ secrets.BE_CRED_PASSWORD }} /t http://timestamp.digicert.com *.dll
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: acre2-extensions-${{ matrix.arch }}
path: |
*.dll
extras/*.exe
plugin
symbols
retention-days: 1
publish-test:
needs: [build, compile]
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Prepare Archives
run: |
echo "Organize"
mv acre2/* .
mv acre2-extensions-*/*.dll @acre2/
mv acre2-extensions-*/extras/*.exe @acre2/extras/
mkdir @acre2/plugin && cp -r acre2-extensions-*/plugin/* @acre2/plugin/ # mv can't merge directories
mkdir symbols && mv acre2-extensions-*/symbols/* .
echo "::group::Archive build"
zip -r acre2_${{ needs.build.outputs.VERSION }}${{ github.event.inputs.label }}.zip @acre2
echo "::endgroup::"
echo "::group::Archive symbols"
zip -r acre2_${{ needs.build.outputs.VERSION }}${{ github.event.inputs.label }}_symbols.zip x86 x64
echo "::endgroup::"
ls *.zip
- name: Upload to FTP (ACRE2)
uses: appleboy/[email protected]
with:
host: ${{ secrets.FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
source: "acre2_${{ needs.build.outputs.VERSION }}${{ github.event.inputs.label }}.zip"
target: "${{ secrets.FTP_SERVER }}/test/${{ github.event.inputs.path }}"
- name: Upload to FTP (Symbols)
uses: appleboy/[email protected]
with:
host: ${{ secrets.FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
source: "acre2_${{ needs.build.outputs.VERSION }}${{ github.event.inputs.label }}_symbols.zip"
target: "${{ secrets.FTP_SERVER }}/test/${{ github.event.inputs.path }}"
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: Publisher
SLACK_ICON_EMOJI: ":package:"
SLACK_MESSAGE: 'Test-Build uploaded! https://${{ secrets.FTP_SERVER }}/dev/acre2_${{ needs.build.outputs.VERSION }}${{ github.event.inputs.label }}.zip'
SLACK_TITLE: Release Status
MSG_MINIMAL: actions url
publish-dev:
needs: [build, compile]
if: github.ref == 'refs/heads/development-build'
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Prepare Archives
run: |
echo "Organize"
mv acre2/* .
mv acre2-extensions-*/*.dll @acre2/
mv acre2-extensions-*/extras/*.exe @acre2/extras/
mkdir @acre2/plugin && cp -r acre2-extensions-*/plugin/* @acre2/plugin/ # mv can't merge directories
mkdir symbols && mv acre2-extensions-*/symbols/* .
echo "::group::Archive build"
zip -r acre2_${{ needs.build.outputs.VERSION }}.zip @acre2
echo "::endgroup::"
echo "::group::Archive symbols"
zip -r acre2_${{ needs.build.outputs.VERSION }}_symbols.zip x86 x64
echo "::endgroup::"
ls *.zip
- name: Upload to FTP (ACRE2)
uses: appleboy/[email protected]
with:
host: ${{ secrets.FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
source: "acre2_${{ needs.build.outputs.VERSION }}.zip"
target: "${{ secrets.FTP_SERVER }}/dev"
- name: Upload to FTP (Symbols)
uses: appleboy/[email protected]
with:
host: ${{ secrets.FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
source: "acre2_${{ needs.build.outputs.VERSION }}_symbols.zip"
target: "${{ secrets.FTP_SERVER }}/symbols"
- name: Upload to Steam (ACRE2 Dev Builds)
uses: arma-actions/workshop-upload@v1
with:
appId: '107410'
itemId: '774084145' # Dev Builds
contentPath: '@acre2'
changelog: 'Version ${{ needs.build.outputs.VERSION }} - See changelog on GitHub: https://github.com/IDI-Systems/acre2/compare/release-build...development-build'
env:
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: Publisher
SLACK_ICON_EMOJI: ":package:"
SLACK_MESSAGE: 'Dev-Build uploaded! https://${{ secrets.FTP_SERVER }}/dev/acre2_${{ needs.build.outputs.VERSION }}.zip'
SLACK_TITLE: Release Status
MSG_MINIMAL: actions url
publish-release:
needs: [build, compile]
if: github.ref == 'refs/heads/release-build'
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Prepare Archives
run: |
echo "Organize"
mv acre2/* .
mv acre2-extensions-*/*.dll @acre2/
mv acre2-extensions-*/extras/*.exe @acre2/extras/
mkdir @acre2/plugin && cp -r acre2-extensions-*/plugin/* @acre2/plugin/ # mv can't merge directories
mkdir symbols && mv acre2-extensions-*/symbols/* .
echo "::group::Archive build"
zip -r acre2_${{ needs.build.outputs.VERSION }}.zip @acre2
echo "::endgroup::"
echo "::group::Archive symbols"
zip -r acre2_${{ needs.build.outputs.VERSION }}_symbols.zip x86 x64
echo "::endgroup::"
ls *.zip
- name: Upload to FTP (ACRE2)
uses: appleboy/[email protected]
with:
host: ${{ secrets.FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
source: "acre2_${{ needs.build.outputs.VERSION }}.zip"
target: "${{ secrets.FTP_SERVER }}/release"
- name: Upload to FTP (Symbols)
uses: appleboy/[email protected]
with:
host: ${{ secrets.FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
source: "acre2_${{ needs.build.outputs.VERSION }}_symbols.zip"
target: "${{ secrets.FTP_SERVER }}/symbols"
- name: Upload to Steam (ACRE2)
uses: arma-actions/workshop-upload@v1
with:
appId: '107410'
itemId: '751965892' # Release
contentPath: '@acre2'
changelog: 'Version ${{ needs.build.outputs.VERSION }} - See changelog on GitHub: https://github.com/IDI-Systems/acre2/releases'
env:
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
- name: Upload to GitHub
id: github_release
uses: softprops/action-gh-release@v1
with:
draft: true
files: acre2_${{ needs.build.outputs.VERSION }}.zip
name: 'ACRE2 v${{ needs.build.outputs.VERSION }}'
tag_name: v${{ needs.build.outputs.VERSION }}
target_commitish: ${{ github.sha }}
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: Publisher
SLACK_ICON_EMOJI: ":package:"
SLACK_MESSAGE: 'Release uploaded and published! Go to ${{ steps.github_release.outputs.url }} to finalize release notes and publish on GitHub.'
SLACK_TITLE: Release Status
MSG_MINIMAL: actions url