diff options
Diffstat (limited to '.github/workflows/create_release.yml')
| -rw-r--r-- | .github/workflows/create_release.yml | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml new file mode 100644 index 000000000..fba2ec1b1 --- /dev/null +++ b/.github/workflows/create_release.yml @@ -0,0 +1,147 @@ +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: + - 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: [self-hosted, linux, x64] + 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 |