name: Build release on: # push pull_request: types: [closed] branches: [ main ] jobs: windows-build: if: >- github.event.pull_request.merged == true && contains( github.event.pull_request.labels.*.name, 'release') name: Build Windows runs-on: [self-hosted, windows, x64] strategy: matrix: config: - 'release' arch: - 'x64' env: VCPKG_VERSION: 2022.03.10 steps: - uses: actions/checkout@v2 - name: Setup xmake uses: xmake-io/github-action-setup-xmake@v1 with: xmake-version: 2.6.4 - name: Installing vcpkg run: | git clone -b ${{env.VCPKG_VERSION}} --single-branch https://github.com/Microsoft/vcpkg.git .vcpkg cd .vcpkg .\bootstrap-vcpkg.bat .\vcpkg.exe integrate install cd .. - name: Cache vcpkg uses: actions/cache@v2 with: path: | ${{ github.workspace }}\.vcpkg\installed key: ${{ runner.os }}-${{ matrix.config }}-${{env.VCPKG_VERSION}}-${{ hashFiles('xmake.lua') }}-${{ matrix.arch }}-v5 - name: Config run: | xmake config -v -y -m ${{ matrix.config }} --arch=${{ matrix.arch }} env: VCPKG_ROOT: ${{ github.workspace }}/.vcpkg - name: Build run: | xmake build -v -y env: VCPKG_ROOT: ${{ github.workspace }}/.vcpkg # - name: Create Archive # run: | # cd .\build\windows\${{ matrix.arch }}\${{ matrix.config }} # C:\'Program Files'\7-Zip\7z.exe a -r ..\..\..\..\windows-${{ matrix.arch }}-${{ matrix.config }}.zip * # cd ..\..\..\.. - name: Create Archive run: | cd .\build\windows\${{ matrix.arch }}\${{ matrix.config }} C:\'Program Files'\7-Zip\7z.exe a -r ..\..\..\..\zenserver-win64.zip zenserver.exe cd ..\..\..\.. - name: Get current release version info run: | $repo = "EpicGames/zen" $releases = "https://api.github.com/repos/$repo/releases/latest" Write-Host Determining latest release $latest = (Invoke-WebRequest -Headers @{"Accept"="application/vnd.github.v3+json";"Authorization"="token ${{ secrets.GITHUB_TOKEN }}"} $releases | ConvertFrom-Json)[0] $current_version_tag = [version]$latest.tag_name.replace('v','') echo "Current version" $current_version_tag if ($current_version_tag.Revision.Equals(9)) { if ($current_version_tag.Build.Equals(9)) { $new_version_tag = [version]::New($current_version_tag.Major,$current_version_tag.Minor+1,0,0).toString() }else { $new_version_tag = [version]::New($current_version_tag.Major,$current_version_tag.Minor,$current_version_tag.Build+1,0).toString() } }else { $new_version_tag = [version]::New($current_version_tag.Major,$current_version_tag.Minor,$current_version_tag.Build,$current_version_tag.Revision+1).toString() } echo $new_version_tag echo "new_version_tag=$new_version_tag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Create Release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: v${{ env.new_version_tag }} release_name: Release draft: false prerelease: false # - name: Create Release # id: create_release # uses: actions/create-release@v1 # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # with: # tag_name: ${{ github.ref_name }} # release_name: Release ${{ github.head_ref }} # draft: false # prerelease: false # - name: Upload Release Asset # id: upload-release-asset # uses: actions/upload-release-asset@v1 # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # with: # upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps # asset_path: .\windows-${{ matrix.arch }}-${{ matrix.config }}.zip # asset_name: windows-${{ matrix.arch }}-${{ matrix.config }} # asset_content_type: application/zip - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: .\zenserver-win64.zip asset_name: zenserver-win64.zip asset_content_type: application/zip