fix release pipeline #243
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Build' | |
env: | |
VERSION: 4.0.0 | |
BUILD_TYPE: Release | |
ARCH: x64 | |
VCPKG_CONFIG: Release | |
VCPKG_HASH: f61a294e765b257926ae9e9d85f96468a0af74e7 | |
DOC_INSTANCE: wrs/bt | |
DOC_ARTIFACT: webHelpBT2-all.zip | |
DOC_ALGOLIA_ARTIFACT: algolia-indexes-BT.zip | |
DOC_DOCKER_VERSION: 232.10275 | |
on: [push, workflow_dispatch] | |
# Gives the workflow permissions to clone the repo and create a page deployment | |
permissions: | |
id-token: write | |
pages: write | |
jobs: | |
build-win: | |
strategy: | |
fail-fast: false | |
matrix: | |
config: [ {triplet: x64-windows-static, suffix: '-static'}, {triplet: x64-windows, suffix: '-dynamic' } ] | |
runs-on: windows-latest | |
name: 'Windows Binary' | |
env: | |
VCPKG_DEFAULT_VCPKG_TRIPLET: ${{ matrix.config.triplet }} | |
VCPKG_TRIPLET: ${{ matrix.config.triplet }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: pre-build patch script | |
run: .\pre-build.ps1 | |
shell: pwsh | |
- uses: friendlyanon/setup-vcpkg@v1 | |
# seems like the absense of commit hash expects vcpkg submodule, i don't want that | |
with: | |
committish: ${{ env.VCPKG_HASH }} | |
# set to false to clear any cache in case of build errors | |
cache: false | |
# - name: Setup Python | |
# uses: actions/setup-python@v4 | |
# with: | |
# python-version: '3.11' | |
- name: ⚙️ configure | |
run: > | |
cmake -B build -S . | |
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
-D "CMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" | |
-D "VCPKG_TARGET_TRIPLET=${{ env.VCPKG_TRIPLET }}" | |
working-directory: . | |
- name: 🏭 build | |
run: cmake --build build --config ${{ env.VCPKG_CONFIG }} | |
working-directory: . | |
- name: debug | |
run: ls -R | |
working-directory: build/test | |
- name: 🧪 unit tests | |
run: .\test.exe | |
working-directory: build/test/Release | |
- name: 📦 pack | |
run: cpack -C ${{ env.BUILD_TYPE }} | |
working-directory: build | |
# - name: debug | |
# run: ls -R | |
# working-directory: build | |
- name: Create artifacts directory | |
run: mkdir atf | |
# put the following inside "atf" subdir: | |
# 1. msi installer, renamed after version number | |
# 2. zipped .exe | |
# 3. version.txt containing version number | |
- name: prep artifacts | |
run: | | |
cp build/bt.msi atf/${{ env.MSI_FILE_NAME }} | |
Compress-Archive -Path build/bt/Release/bt.exe -DestinationPath atf/${{ env.ZIP_FILE_NAME }} -CompressionLevel Optimal | |
Compress-Archive -Path build/bt/Release/bt.pdb -DestinationPath atf/${{ env.PDB_FILE_NAME }} -CompressionLevel Optimal | |
"${{ env.VERSION }}" | Out-File atf/version.txt -NoNewline | |
(Get-FileHash -Algorithm SHA256 -Path atf/${{ env.ZIP_FILE_NAME }}).Hash | Out-File atf/${{ env.ZIP_FILE_NAME }}.sha256.txt | |
(Get-FileHash -Algorithm SHA256 -Path atf/${{ env.MSI_FILE_NAME }}).Hash | Out-File atf/${{ env.MSI_FILE_NAME }}.sha256.txt | |
cp docs/release-notes.md atf/ | |
cp docs/instructions.md atf/ | |
env: | |
ZIP_FILE_NAME: bt-${{ env.VERSION }}.zip | |
PDB_FILE_NAME: pdb-${{ env.VERSION }}.zip | |
MSI_FILE_NAME: bt-${{ env.VERSION }}.msi | |
- uses: actions/upload-artifact@v4 | |
name: collect binaries | |
with: | |
name: bin${{ matrix.config.suffix }} | |
path: atf/* | |
wrs-build: | |
runs-on: ubuntu-latest | |
name: 'Build Docs' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build docs | |
uses: JetBrains/writerside-github-action@v4 | |
with: | |
instance: ${{ env.DOC_INSTANCE }} | |
artifact: ${{ env.DOC_INSTANCE }} | |
docker-version: ${{ env.DOC_DOCKER_VERSION }} | |
- name: Upload documentation | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs | |
path: artifacts/*.zip | |
retention-days: 1 | |
wrs-deploy: | |
needs: wrs-build | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
name: 'Deploy Docs to GitHub Pages' | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: docs | |
- name: Unzip artifact | |
run: unzip -O UTF-8 -qq ${{ env.DOC_ARTIFACT }} -d dir | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: dir | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |