Reorganize workflows and use multiple environments for different release stages

This commit is contained in:
smallmodel 2024-09-18 18:21:25 +02:00
parent 41298b53d4
commit c221cfd493
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512
4 changed files with 37 additions and 17 deletions

17
.github/workflows/branches-build.yml vendored Normal file
View file

@ -0,0 +1,17 @@
name: Build branch
on:
push:
branches:
- '**'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-all:
uses: ./.github/workflows/shared-build.yml
with:
environment: "testing"

View file

@ -1,19 +1,16 @@
name: Build name: Shared build workflow
on: on:
push:
branches:
- '**'
pull_request:
workflow_call: workflow_call:
inputs:
concurrency: environment:
group: ${{ github.workflow }}-${{ github.ref }} required: true
cancel-in-progress: true type: string
env: env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo BUILD_TYPE: RelWithDebInfo
RELEASE_STAGE: ${{ vars.RELEASE_STAGE || 'unstable' }}
jobs: jobs:
build-platform-linux: build-platform-linux:
@ -30,7 +27,8 @@ jobs:
] ]
name: "Building for platform linux-${{matrix.architecture.name}}" name: "Building for platform linux-${{matrix.architecture.name}}"
runs-on: ubuntu-22.04 runs-on: "ubuntu-22.04"
environment: ${{ inputs.environment }}
steps: steps:
- name: Settings - name: Settings
@ -95,7 +93,8 @@ jobs:
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }} \ -DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }} \
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' \ -DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' \
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/include' \ -DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/include' \
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV -DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} \
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'" >> $GITHUB_ENV
- name: Configure CMake - name: Configure CMake
working-directory: ${{github.workspace}} working-directory: ${{github.workspace}}
@ -141,7 +140,8 @@ jobs:
] ]
name: "Building for platform windows-${{matrix.architecture.name}}" name: "Building for platform windows-${{matrix.architecture.name}}"
runs-on: windows-2022 runs-on: "windows-2022"
environment: ${{ inputs.environment }}
steps: steps:
- name: Settings - name: Settings
@ -212,7 +212,8 @@ jobs:
-DBISON_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_bison.exe' ` -DBISON_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_bison.exe' `
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' ` -DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' `
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/include' ` -DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/include' `
-DFLEX_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_flex.exe'".Replace("`r", "").Replace("`n", "") >> $env:GITHUB_ENV -DFLEX_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_flex.exe' `
-DPRODUCT_VERSION_STAGE='${{ env.RELEASE_STAGE }}'".Replace("`r", "").Replace("`n", "") >> $env:GITHUB_ENV
- name: Configure CMake - name: Configure CMake
working-directory: ${{github.workspace}} working-directory: ${{github.workspace}}

View file

@ -6,7 +6,7 @@ on:
- "v*.*.*" - "v*.*.*"
env: env:
RELEASE_TYPE: ${{ vars.RELEASE_TYPE || 'test' }} RELEASE_STAGE: ${{ vars.RELEASE_STAGE || 'unstable' }}
RELEASE_IS_PRERELEASE: ${{ vars.RELEASE_IS_PRELEASE }} RELEASE_IS_PRERELEASE: ${{ vars.RELEASE_IS_PRELEASE }}
permissions: permissions:
@ -14,7 +14,9 @@ permissions:
jobs: jobs:
build-all: build-all:
uses: ./.github/workflows/build-cmake.yml uses: ./.github/workflows/shared-build.yml
with:
environment: "release"
deploy_all: deploy_all:
strategy: strategy:
@ -39,7 +41,7 @@ jobs:
] ]
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
environment: release environment: "release"
needs: [build-all] needs: [build-all]
env: env:
@ -58,6 +60,6 @@ jobs:
- name: Release - name: Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
name: '${{github.ref_name}}-${{env.RELEASE_TYPE}}' name: '${{github.ref_name}}-${{env.RELEASE_STAGE}}'
prerelease: ${{env.RELEASE_IS_PRERELEASE}} prerelease: ${{env.RELEASE_IS_PRERELEASE}}
files: ${{github.workspace}}/${{ env.RELEASE_NAME }}.zip files: ${{github.workspace}}/${{ env.RELEASE_NAME }}.zip