Release #2
Workflow file for this run
This file contains hidden or 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: Release | |
| on: | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| source: | |
| name: Source | |
| runs-on: ubuntu-20.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Generate .version | |
| run: | | |
| cmake -DWRITE_VERSION=1 -P generate_version.cmake | |
| - name: Create bundles | |
| run: | | |
| FOLDER_NAME=grfcodec-${{ github.event.release.tag_name }} | |
| # Rename the folder to grfcodec-NNN | |
| mkdir ${FOLDER_NAME} | |
| find . -maxdepth 1 -not -name . -not -name .git -not -name ${FOLDER_NAME} -exec mv {} ${FOLDER_NAME}/ \; | |
| mkdir -p build/bundles | |
| echo "::group::Create tarball (xz) bundle" | |
| tar --xz -cvf build/bundles/${FOLDER_NAME}-source.tar.xz ${FOLDER_NAME} | |
| echo "::endgroup::" | |
| echo "::group::Create zip bundle" | |
| zip -9 -r build/bundles/${FOLDER_NAME}-source.zip ${FOLDER_NAME} | |
| echo "::endgroup::" | |
| - name: Store bundles | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release upload ${{ github.event.release.tag_name }} build/bundles/* | |
| windows: | |
| needs: source | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [x86, x64] | |
| name: Windows (${{ matrix.arch }}) | |
| runs-on: windows-latest | |
| steps: | |
| - name: Prepare build dir for gh usage | |
| shell: bash | |
| run: | | |
| git init build | |
| cd build | |
| git remote add origin ${{ github.event.repository.html_url }} | |
| - name: Download source | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| shell: bash | |
| run: | | |
| cd build | |
| gh release download ${{ github.event.release.tag_name }} -p "*.xz" -D .. | |
| - name: Unpack source | |
| shell: bash | |
| run: | | |
| tar --xz -xf *-source.tar.xz --strip-components=1 | |
| - name: Setup vcpkg caching | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
| core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
| core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite') | |
| - name: Install vcpkg | |
| run: | | |
| git clone https://github.com/microsoft/vcpkg | |
| .\vcpkg\bootstrap-vcpkg.bat -disableMetrics | |
| - name: Prepare vcpkg | |
| shell: bash | |
| run: | | |
| ./vcpkg/vcpkg install --triplet=${{ matrix.arch }}-windows-static \ | |
| boost-bimap \ | |
| boost-date-time \ | |
| boost-foreach \ | |
| libpng \ | |
| # EOF | |
| - name: Install MSVC problem matcher | |
| uses: ammaraskar/msvc-problem-matcher@master | |
| - name: Configure developer command prompt for ${{ matrix.arch }} | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: ${{ matrix.arch }} | |
| - name: Build | |
| shell: bash | |
| run: | | |
| cd build | |
| echo "::group::CMake" | |
| cmake .. \ | |
| -GNinja \ | |
| -DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \ | |
| -DCMAKE_TOOLCHAIN_FILE="${GITHUB_WORKSPACE}\vcpkg\scripts\buildsystems\vcpkg.cmake" \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| # EOF | |
| echo "::endgroup::" | |
| echo "::group::Build" | |
| cmake --build . | |
| echo "::endgroup::" | |
| - name: Create bundles | |
| shell: bash | |
| run: | | |
| cd build | |
| echo "::group::Run CPack" | |
| cpack | |
| echo "::endgroup::" | |
| - name: Store bundles | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| shell: bash | |
| run: | | |
| cd build | |
| gh release upload ${{ github.event.release.tag_name }} bundles/* |