diff options
| author | Dan Engelbrecht <[email protected]> | 2022-06-02 00:59:47 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-06-02 00:59:47 +0200 |
| commit | 67853dd76bf46991b4a996873e4f3cd51f87109c (patch) | |
| tree | 65f191282759bf8dcd9cd7853ec5d8ca92088c42 /.github | |
| parent | Merge pull request #118 from EpicGames/de/keep-zen-upstream-response (diff) | |
| parent | read part of changelog allowing us to keep history (diff) | |
| download | zen-67853dd76bf46991b4a996873e4f3cd51f87109c.tar.xz zen-67853dd76bf46991b4a996873e4f3cd51f87109c.zip | |
Merge pull request #105 from EpicGames/de/new-release-flow
GitHub Actions release flow
Diffstat (limited to '.github')
| -rw-r--r-- | .github/workflows/create_release.yml | 149 | ||||
| -rw-r--r-- | .github/workflows/update_release.yml | 134 | ||||
| -rw-r--r-- | .github/workflows/validate.yml (renamed from .github/workflows/self_host_build.yml) | 56 |
3 files changed, 199 insertions, 140 deletions
diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml new file mode 100644 index 000000000..7c7bb06cf --- /dev/null +++ b/.github/workflows/create_release.yml @@ -0,0 +1,149 @@ +name: Create Release + +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + bundle-windows: + + runs-on: [self-hosted, windows, x64] + + env: + VCPKG_VERSION: 2022.03.10 + + steps: + - run: echo ${env:PATH} + + - 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 }}-release-${{env.VCPKG_VERSION}}-${{ hashFiles('xmake.lua') }}-x64-v5 + + - name: Bundle + run: | + xmake bundle -v -y + env: + VCPKG_ROOT: ${{ github.workspace }}/.vcpkg + + - name: Upload zenserver-win64 + uses: actions/upload-artifact@v3 + with: + name: zenserver-win64 + path: build/zenserver-win64.zip + + bundle-linux: + runs-on: [self-hosted, linux, x64] + + env: + VCPKG_VERSION: 2022.03.10 + + steps: + - uses: actions/checkout@v2 + + - name: Set up GCC 11 + uses: egor-tensin/setup-gcc@v1 + with: + version: 11 + platform: x64 + + - 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.sh + cd .. + + - name: Cache vcpkg + uses: actions/cache@v2 + with: + path: | + ${{ github.workspace }}/.vcpkg/installed + key: ${{ runner.os }}-release-${{env.VCPKG_VERSION}}-${{ hashFiles('xmake.lua') }}-x64-v5 + + - name: Bundle + run: | + xmake bundle -v -y + env: + VCPKG_ROOT: ${{ github.workspace }}/.vcpkg + + - name: Upload zenserver-linux + uses: actions/upload-artifact@v3 + with: + name: zenserver-linux + path: build/zenserver-linux.zip + + create-release: + runs-on: ubuntu-latest + needs: [bundle-linux, bundle-windows] + steps: + - uses: actions/checkout@v2 + + - name: Download Linux artifacts + uses: actions/download-artifact@v1 + with: + name: zenserver-linux + path: linux + + - name: Download Windows artifacts + uses: actions/download-artifact@v1 + with: + name: zenserver-win64 + path: win64 + + - name: Check prerelease + id: get-prerelease + uses: haya14busa/action-cond@v1 + with: + cond: ${{contains(github.ref, '-pre')}} + if_true: "true" + if_false: "false" + + - name: Extract Version Changes + run: | + sed '1,/^##/!d;/##/d' CHANGELOG.md > CHANGELOG.tmp + + - name: Read CHANGELOG.tmp + id: read_changelog + uses: andstor/file-reader-action@v1 + with: + path: "CHANGELOG.tmp" + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{github.ref.name}} + body: | + ${{steps.read_changelog.outputs.contents}} + draft: false + prerelease: ${{steps.get-prerelease.outputs.value}} + files: | + linux/zenserver-linux.zip + win64/zenserver-win64.zip diff --git a/.github/workflows/update_release.yml b/.github/workflows/update_release.yml deleted file mode 100644 index 27d5e2783..000000000 --- a/.github/workflows/update_release.yml +++ /dev/null @@ -1,134 +0,0 @@ -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 - diff --git a/.github/workflows/self_host_build.yml b/.github/workflows/validate.yml index b728e33c3..7f022c76c 100644 --- a/.github/workflows/self_host_build.yml +++ b/.github/workflows/validate.yml @@ -1,12 +1,24 @@ -name: Validate Build +name: Validate on: pull_request: - types: [opened, reopened, synchronize, reopened] + types: [opened, reopened, synchronize] branches: [ main ] jobs: + cancel-old-build: + name: Cancel previous builds + runs-on: [self-hosted, linux, x64] + + steps: + - name: Cancel Previous Runs + if: ${{ github.ref_name != 'main'}} + uses: styfle/[email protected] + with: + access_token: ${{ github.token }} + clang-format: + needs: cancel-old-build name: Check clang-format runs-on: [self-hosted, linux, x64] @@ -21,7 +33,8 @@ jobs: exclude-regex: (.*thirdparty.*) windows-build: - name: Build Windows + needs: cancel-old-build + name: Build & Test Windows runs-on: [self-hosted, windows, x64] timeout-minutes: 10 strategy: @@ -35,7 +48,8 @@ jobs: VCPKG_VERSION: 2022.03.10 steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2 - name: Setup xmake uses: xmake-io/github-action-setup-xmake@v1 @@ -57,6 +71,20 @@ jobs: ${{ github.workspace }}\.vcpkg\installed key: ${{ runner.os }}-${{ matrix.config }}-${{env.VCPKG_VERSION}}-${{ hashFiles('xmake.lua') }}-${{ matrix.arch }}-v5 + - name: Bundle + if: ${{ github.ref_name == 'main'}} + run: | + xmake bundle -v -y + env: + VCPKG_ROOT: ${{ github.workspace }}/.vcpkg + + - name: Upload zenserver-linux + if: ${{ github.ref_name == 'main'}} + uses: actions/upload-artifact@v3 + with: + name: zenserver-linux + path: build/zenserver-linux.zip + - name: Config run: | xmake config -v -y -m ${{ matrix.config }} --arch=${{ matrix.arch }} @@ -70,7 +98,8 @@ jobs: VCPKG_ROOT: ${{ github.workspace }}/.vcpkg linux-build: - name: Build Linux + needs: cancel-old-build + name: Build & Test Linux runs-on: [self-hosted, linux, x64] timeout-minutes: 10 strategy: @@ -84,7 +113,8 @@ jobs: VCPKG_VERSION: 2022.03.10 steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2 - name: Set up GCC 11 uses: egor-tensin/setup-gcc@v1 @@ -111,6 +141,20 @@ jobs: ${{ github.workspace }}/.vcpkg/installed key: ${{ runner.os }}-${{ matrix.config }}-${{env.VCPKG_VERSION}}-${{ hashFiles('xmake.lua') }}-${{ matrix.arch }}-v5 + - name: Bundle + if: ${{ github.ref_name == 'main'}} + run: | + xmake bundle -v -y + env: + VCPKG_ROOT: ${{ github.workspace }}/.vcpkg + + - name: Upload zenserver-win64 + if: ${{ github.ref_name == 'main'}} + uses: actions/upload-artifact@v3 + with: + name: zenserver-win64 + path: build/zenserver-win64.zip + - name: Config run: | xmake config -v -y -m ${{ matrix.config }} --arch=${{ matrix.arch }} |