Build and Release #42
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: Build and Release | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install MinGW toolchain | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y mingw-w64 ninja-build | |
| - name: Configure git for private fetch | |
| run: | | |
| git config --global url."https://${{ secrets.GH_PAT }}:@github.com/".insteadOf "https://github.com/" | |
| - name: Configure CMake | |
| run: > | |
| cmake -S . -B build | |
| -G Ninja | |
| -DCMAKE_BUILD_TYPE=RelWithDebInfo | |
| -DCMAKE_CXX_STANDARD=17 | |
| -DCMAKE_SYSTEM_NAME=Windows | |
| -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc | |
| -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ | |
| -DCMAKE_RC_COMPILER=x86_64-w64-mingw32-windres | |
| - name: Build | |
| run: cmake --build build --config RelWithDebInfo | |
| - name: Read version.txt | |
| id: version | |
| run: | | |
| VERSION=$(cat build/version.txt) | |
| echo "VERSION=v${VERSION}" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| with: | |
| tag_name: ${{ steps.version.outputs.VERSION }} | |
| release_name: ${{ steps.version.outputs.VERSION }} | |
| draft: true | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload DLL to Release | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./build/UnhideNPCs.dll | |
| asset_name: UnhideNPCs.dll | |
| asset_content_type: application/octet-stream | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload Debug Symbols to Release | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./build/UnhideNPCs.dll.debug | |
| asset_name: UnhideNPCs.dll.debug | |
| asset_content_type: application/octet-stream | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |