diff options
| author | Stefan Boberg <[email protected]> | 2026-03-27 22:37:45 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-03-27 22:37:45 +0100 |
| commit | 7fcf4c360ffb0e6bf340581c37ae2ed1f6d51e21 (patch) | |
| tree | e0ae71c117958261bbb2fb3cae5845e809360e4e /.github/workflows | |
| parent | changelog 5.8.0 header (diff) | |
| download | zen-7fcf4c360ffb0e6bf340581c37ae2ed1f6d51e21.tar.xz zen-7fcf4c360ffb0e6bf340581c37ae2ed1f6d51e21.zip | |
Skip release workflow when version tag already exists (#898)
Split create_release.yml into a lightweight gate that checks for an existing git tag and a reusable workflow (create_release_impl.yml) containing all build/release jobs. When VERSION.txt is merged to a non-release branch the tag check short-circuits the entire workflow, preventing duplicate builds and failed artifact uploads.
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/create_release.yml | 299 | ||||
| -rw-r--r-- | .github/workflows/create_release_impl.yml | 285 |
2 files changed, 308 insertions, 276 deletions
diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 1ea3d2c3d..6cf7f72fe 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -1,287 +1,34 @@ name: Create Release -env: - XMAKE_VERSION: 2.9.9 - WINDOWS_SDK_VERSION: 22621 - XMAKE_GLOBALDIR: ${{ github.workspace }}/../.xmake_shared - on: push: paths: - 'VERSION.txt' jobs: - bundle-windows: - runs-on: [windows, x64, zen] - timeout-minutes: 25 - - steps: - - uses: actions/checkout@v4 - - - name: Setup xmake - uses: ue-foundation/[email protected] - with: - xmake-version: ${{env.XMAKE_VERSION}} - - - name: Config - run: | - xmake config -v -y -m release --zensentry=yes --zencompute=no --zenhorde=no --zennomad=no - - - name: Build and Bundle - run: | - xmake bundle -v -y --codesignidentity="Epic Games" - - - name: Upload To Sentry - run: | - scripts\sentry-cli debug-files bundle-sources build/windows/x64/release/zenserver.pdb build/windows/x64/release/zen.pdb - scripts\sentry-cli --auth-token ${{ secrets.SENTRY_API_KEY }} debug-files upload --org to --project zen-server build/windows/x64/release/zenserver.exe build/windows/x64/release/zen.exe build/windows/x64/release/zenserver.pdb build/windows/x64/release/zen.pdb build/windows/x64/release/zenserver.src.zip build/windows/x64/release/zen.src.zip - - - name: Upload zenserver-win64 - uses: actions/upload-artifact@v3-node20 - with: - name: zenserver-win64 - path: build/zenserver-win64.zip - - bundle-linux: + check-release: runs-on: [linux, x64, zen] - timeout-minutes: 25 - + timeout-minutes: 2 + outputs: + already_released: ${{ steps.check_tag.outputs.exists }} steps: - uses: actions/checkout@v4 - - - name: Install UE Toolchain - run: | - rm -rf ./.tmp-ue-toolchain - ./scripts/ue_build_linux/get_ue_toolchain.sh ./.tmp-ue-toolchain - - - name: Setup xmake - uses: ue-foundation/[email protected] with: - xmake-version: ${{env.XMAKE_VERSION}} - - - name: Config - run: | - xmake config -v -y -m release --zensentry=yes --zencompute=no --zenhorde=no --zennomad=no --toolchain=ue-clang --sdk=${{ github.workspace }}/.tmp-ue-toolchain - - - name: Build and Bundle - run: | - xmake bundle -v -y - - - name: Get Sentry CLI - run: | - curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION="3.2.0" bash - ls -la ./scripts - env: - INSTALL_DIR: ./scripts - - - name: Upload To Sentry - run: | - scripts/sentry-cli debug-files bundle-sources build/linux/x86_64/release/zenserver.sym build/linux/x86_64/release/zen.sym - scripts/sentry-cli --auth-token ${{ secrets.SENTRY_API_KEY }} debug-files upload --org to --project zen-server build/linux/x86_64/release/zenserver build/linux/x86_64/release/zen build/linux/x86_64/release/zenserver.sym build/linux/x86_64/release/zen.sym build/linux/x86_64/release/zenserver.src.zip build/linux/x86_64/release/zen.src.zip - - - name: Upload zenserver-linux - uses: actions/upload-artifact@v3-node20 - with: - name: zenserver-linux - path: build/zenserver-linux.zip - - bundle-macos: - runs-on: [macos, x64, zen] - timeout-minutes: 25 - - steps: - - uses: actions/checkout@v4 - - - name: Setup xmake - uses: ue-foundation/[email protected] - with: - xmake-version: ${{env.XMAKE_VERSION}} - - - name: Config - run: | - xmake config -v -y -m release --zensentry=yes --zencompute=no --zenhorde=no --zennomad=no - - - name: Build and Bundle - run: | - xmake bundle -v -y --codesignidentity="Developer ID Application" - - - name: Get Sentry CLI - run: | - curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION="3.2.0" bash - ls -la ./scripts - env: - INSTALL_DIR: ./scripts - - - name: Upload To Sentry arm64 - run: | - scripts/sentry-cli debug-files bundle-sources build/macosx/arm64/release/zenserver.dSYM build/macosx/arm64/release/zen.dSYM - scripts/sentry-cli --auth-token ${{ secrets.SENTRY_API_KEY }} debug-files upload --org to --project zen-server build/macosx/arm64/release/zenserver build/macosx/arm64/release/zen build/macosx/arm64/release/zenserver.dSYM build/macosx/arm64/release/zen.dSYM build/macosx/arm64/release/zenserver.src.zip build/macosx/arm64/release/zen.src.zip - - - name: Upload To Sentry x86_64 - run: | - scripts/sentry-cli debug-files bundle-sources build/macosx/x86_64/release/zenserver.dSYM build/macosx/x86_64/release/zen.dSYM - scripts/sentry-cli --auth-token ${{ secrets.SENTRY_API_KEY }} debug-files upload --org to --project zen-server build/macosx/x86_64/release/zenserver build/macosx/x86_64/release/zen build/macosx/x86_64/release/zenserver.dSYM build/macosx/x86_64/release/zen.dSYM build/macosx/x86_64/release/zenserver.src.zip build/macosx/x86_64/release/zen.src.zip - - - name: Upload zenserver-macos - uses: actions/upload-artifact@v3-node20 - with: - name: zenserver-macos - path: build/zenserver-macos.zip - - docker-build: - name: Build Docker Images - runs-on: [linux, x64, zen] - timeout-minutes: 15 - needs: [bundle-linux, bundle-windows] - - steps: - - uses: actions/checkout@v4 - - - name: Read VERSION.txt - id: read_version - run: echo "content=$(cat VERSION.txt)" >> "$GITHUB_OUTPUT" - - - name: Download Linux bundle - uses: actions/download-artifact@v3-node20 - with: - name: zenserver-linux - path: artifacts/linux - - - name: Download Windows bundle - uses: actions/download-artifact@v3-node20 - with: - name: zenserver-win64 - path: artifacts/win64 - - - name: Extract binaries - run: | - mkdir -p build/linux/x86_64/release - unzip artifacts/linux/zenserver-linux.zip -d artifacts/linux-extracted - cp artifacts/linux-extracted/zenserver build/linux/x86_64/release/ - mkdir -p build/win-binary-staging - unzip artifacts/win64/zenserver-win64.zip -d artifacts/win-extracted - cp artifacts/win-extracted/zenserver.exe build/win-binary-staging/ - - - name: Login to Amazon ECR - run: | - aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 728559092788.dkr.ecr.us-east-1.amazonaws.com - - - name: Build and push Docker image (with Wine + Windows binary) - run: | - docker build \ - -t 728559092788.dkr.ecr.us-east-1.amazonaws.com/zenserver:${{ steps.read_version.outputs.content }}-wine \ - --build-arg WIN_BINARY_DIR=build/win-binary-staging \ - -f docker/Dockerfile . - docker push 728559092788.dkr.ecr.us-east-1.amazonaws.com/zenserver:${{ steps.read_version.outputs.content }}-wine - - - name: Build and push Docker image (Linux only, no Wine) - run: | - docker build \ - -t 728559092788.dkr.ecr.us-east-1.amazonaws.com/zenserver:${{ steps.read_version.outputs.content }}-linux \ - --build-arg INSTALL_WINE=false \ - -f docker/Dockerfile . - docker push 728559092788.dkr.ecr.us-east-1.amazonaws.com/zenserver:${{ steps.read_version.outputs.content }}-linux - - create-release: - runs-on: [linux, x64, zen] - timeout-minutes: 5 - needs: [bundle-linux, bundle-macos, bundle-windows] - - steps: - - uses: actions/checkout@v4 - - - name: Read VERSION.txt - id: read_version - uses: ue-foundation/[email protected] - with: - path: "./VERSION.txt" - - - name: Get Sentry CLI - run: | - curl -sL https://sentry.io/get-cli/ | bash - ls -la ./scripts - env: - INSTALL_DIR: ./scripts - - - name: Create Release in Sentry - run: | - scripts/sentry-cli --auth-token ${{ secrets.SENTRY_API_KEY }} releases new --org to --project zen-server ${{steps.read_version.outputs.content}} - - - name: Download Linux artifacts - uses: actions/download-artifact@v3-node20 - with: - name: zenserver-linux - path: linux - - - name: Download MacOS artifacts - uses: actions/download-artifact@v3-node20 - with: - name: zenserver-macos - path: macos - - - name: Download Windows artifacts - uses: actions/download-artifact@v3-node20 - with: - name: zenserver-win64 - path: win64 - - - name: Extract Version Changes - run: | - sed '1,/^##/!d;/##/d' CHANGELOG.md > CHANGELOG.tmp - - - name: Read CHANGELOG.tmp - id: read_changelog - uses: ue-foundation/[email protected] - with: - path: "./CHANGELOG.tmp" - - - name: Check prerelease - id: get-prerelease - uses: ue-foundation/[email protected] - with: - cond: ${{contains(steps.read_version.outputs.content, '-pre')}} - if_true: "true" - if_false: "false" - - - name: Create Release - id: create_release - uses: ue-foundation/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: v${{steps.read_version.outputs.content}} - target_commitish: ${{ github.sha }} - body: | - ${{steps.read_changelog.outputs.content}} - draft: false - prerelease: ${{steps.get-prerelease.outputs.value}} - files: | - linux/zenserver-linux.zip - win64/zenserver-win64.zip - macos/zenserver-macos.zip - - - name: Finalize Release in Sentry - run: | - scripts/sentry-cli --auth-token ${{ secrets.SENTRY_API_KEY }} releases finalize --org to --project zen-server ${{steps.read_version.outputs.content}} - - - name: Replicate release to public github - uses: ue-foundation/[email protected] - with: - token: ${{ secrets.ZEN_RELEASE_GITHUB_EE_TOKEN }} - src_repo: ue-foundation/zen - src_repo_github_api_url: https://api.github.ol.epicgames.net - - dest_token: ${{ secrets.ZEN_RELEASE_GITHUB_TOKEN }} - dest_repo: EpicGames/zen - dest_repo_github_api_url: https://api.github.com - - copy_assets: true - - # we generally expect to be up to date so we only replicate a few releases which should be the current one (plus potentially a few more) - limit: 3 - - # Working around issues with releases 5.5.2 and earlier that it attempts to replicate even though they already exist - min_version: v5.5.4 - - # we skip replicating pre and draft releases to keep the public repo focused on the releases itself - skip_prerelease: true - skip_draft: true + fetch-depth: 0 + + - name: Check if release tag already exists + id: check_tag + run: | + VERSION=$(cat VERSION.txt | tr -d '[:space:]') + if git tag -l "v$VERSION" | grep -q .; then + echo "Tag v$VERSION already exists, skipping release" + echo "exists=true" >> "$GITHUB_OUTPUT" + else + echo "Tag v$VERSION does not exist, proceeding with release" + echo "exists=false" >> "$GITHUB_OUTPUT" + fi + + release: + needs: [check-release] + if: needs.check-release.outputs.already_released != 'true' + uses: ./.github/workflows/create_release_impl.yml + secrets: inherit diff --git a/.github/workflows/create_release_impl.yml b/.github/workflows/create_release_impl.yml new file mode 100644 index 000000000..0f0bab9da --- /dev/null +++ b/.github/workflows/create_release_impl.yml @@ -0,0 +1,285 @@ +name: Create Release (impl) +env: + XMAKE_VERSION: 2.9.9 + WINDOWS_SDK_VERSION: 22621 + XMAKE_GLOBALDIR: ${{ github.workspace }}/../.xmake_shared + +on: + workflow_call: + +jobs: + bundle-windows: + runs-on: [windows, x64, zen] + timeout-minutes: 25 + + steps: + - uses: actions/checkout@v4 + + - name: Setup xmake + uses: ue-foundation/[email protected] + with: + xmake-version: ${{env.XMAKE_VERSION}} + + - name: Config + run: | + xmake config -v -y -m release --zensentry=yes --zencompute=no --zenhorde=no --zennomad=no + + - name: Build and Bundle + run: | + xmake bundle -v -y --codesignidentity="Epic Games" + + - name: Upload To Sentry + run: | + scripts\sentry-cli debug-files bundle-sources build/windows/x64/release/zenserver.pdb build/windows/x64/release/zen.pdb + scripts\sentry-cli --auth-token ${{ secrets.SENTRY_API_KEY }} debug-files upload --org to --project zen-server build/windows/x64/release/zenserver.exe build/windows/x64/release/zen.exe build/windows/x64/release/zenserver.pdb build/windows/x64/release/zen.pdb build/windows/x64/release/zenserver.src.zip build/windows/x64/release/zen.src.zip + + - name: Upload zenserver-win64 + uses: actions/upload-artifact@v3-node20 + with: + name: zenserver-win64 + path: build/zenserver-win64.zip + + bundle-linux: + runs-on: [linux, x64, zen] + timeout-minutes: 25 + + steps: + - uses: actions/checkout@v4 + + - name: Install UE Toolchain + run: | + rm -rf ./.tmp-ue-toolchain + ./scripts/ue_build_linux/get_ue_toolchain.sh ./.tmp-ue-toolchain + + - name: Setup xmake + uses: ue-foundation/[email protected] + with: + xmake-version: ${{env.XMAKE_VERSION}} + + - name: Config + run: | + xmake config -v -y -m release --zensentry=yes --zencompute=no --zenhorde=no --zennomad=no --toolchain=ue-clang --sdk=${{ github.workspace }}/.tmp-ue-toolchain + + - name: Build and Bundle + run: | + xmake bundle -v -y + + - name: Get Sentry CLI + run: | + curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION="3.2.0" bash + ls -la ./scripts + env: + INSTALL_DIR: ./scripts + + - name: Upload To Sentry + run: | + scripts/sentry-cli debug-files bundle-sources build/linux/x86_64/release/zenserver.sym build/linux/x86_64/release/zen.sym + scripts/sentry-cli --auth-token ${{ secrets.SENTRY_API_KEY }} debug-files upload --org to --project zen-server build/linux/x86_64/release/zenserver build/linux/x86_64/release/zen build/linux/x86_64/release/zenserver.sym build/linux/x86_64/release/zen.sym build/linux/x86_64/release/zenserver.src.zip build/linux/x86_64/release/zen.src.zip + + - name: Upload zenserver-linux + uses: actions/upload-artifact@v3-node20 + with: + name: zenserver-linux + path: build/zenserver-linux.zip + + bundle-macos: + runs-on: [macos, x64, zen] + timeout-minutes: 25 + + steps: + - uses: actions/checkout@v4 + + - name: Setup xmake + uses: ue-foundation/[email protected] + with: + xmake-version: ${{env.XMAKE_VERSION}} + + - name: Config + run: | + xmake config -v -y -m release --zensentry=yes --zencompute=no --zenhorde=no --zennomad=no + + - name: Build and Bundle + run: | + xmake bundle -v -y --codesignidentity="Developer ID Application" + + - name: Get Sentry CLI + run: | + curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION="3.2.0" bash + ls -la ./scripts + env: + INSTALL_DIR: ./scripts + + - name: Upload To Sentry arm64 + run: | + scripts/sentry-cli debug-files bundle-sources build/macosx/arm64/release/zenserver.dSYM build/macosx/arm64/release/zen.dSYM + scripts/sentry-cli --auth-token ${{ secrets.SENTRY_API_KEY }} debug-files upload --org to --project zen-server build/macosx/arm64/release/zenserver build/macosx/arm64/release/zen build/macosx/arm64/release/zenserver.dSYM build/macosx/arm64/release/zen.dSYM build/macosx/arm64/release/zenserver.src.zip build/macosx/arm64/release/zen.src.zip + + - name: Upload To Sentry x86_64 + run: | + scripts/sentry-cli debug-files bundle-sources build/macosx/x86_64/release/zenserver.dSYM build/macosx/x86_64/release/zen.dSYM + scripts/sentry-cli --auth-token ${{ secrets.SENTRY_API_KEY }} debug-files upload --org to --project zen-server build/macosx/x86_64/release/zenserver build/macosx/x86_64/release/zen build/macosx/x86_64/release/zenserver.dSYM build/macosx/x86_64/release/zen.dSYM build/macosx/x86_64/release/zenserver.src.zip build/macosx/x86_64/release/zen.src.zip + + - name: Upload zenserver-macos + uses: actions/upload-artifact@v3-node20 + with: + name: zenserver-macos + path: build/zenserver-macos.zip + + docker-build: + name: Build Docker Images + runs-on: [linux, x64, zen] + timeout-minutes: 15 + needs: [bundle-linux, bundle-windows] + + steps: + - uses: actions/checkout@v4 + + - name: Read VERSION.txt + id: read_version + run: echo "content=$(cat VERSION.txt)" >> "$GITHUB_OUTPUT" + + - name: Download Linux bundle + uses: actions/download-artifact@v3-node20 + with: + name: zenserver-linux + path: artifacts/linux + + - name: Download Windows bundle + uses: actions/download-artifact@v3-node20 + with: + name: zenserver-win64 + path: artifacts/win64 + + - name: Extract binaries + run: | + mkdir -p build/linux/x86_64/release + unzip artifacts/linux/zenserver-linux.zip -d artifacts/linux-extracted + cp artifacts/linux-extracted/zenserver build/linux/x86_64/release/ + mkdir -p build/win-binary-staging + unzip artifacts/win64/zenserver-win64.zip -d artifacts/win-extracted + cp artifacts/win-extracted/zenserver.exe build/win-binary-staging/ + + - name: Login to Amazon ECR + run: | + aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 728559092788.dkr.ecr.us-east-1.amazonaws.com + + - name: Build and push Docker image (with Wine + Windows binary) + run: | + docker build \ + -t 728559092788.dkr.ecr.us-east-1.amazonaws.com/zenserver:${{ steps.read_version.outputs.content }}-wine \ + --build-arg WIN_BINARY_DIR=build/win-binary-staging \ + -f docker/Dockerfile . + docker push 728559092788.dkr.ecr.us-east-1.amazonaws.com/zenserver:${{ steps.read_version.outputs.content }}-wine + + - name: Build and push Docker image (Linux only, no Wine) + run: | + docker build \ + -t 728559092788.dkr.ecr.us-east-1.amazonaws.com/zenserver:${{ steps.read_version.outputs.content }}-linux \ + --build-arg INSTALL_WINE=false \ + -f docker/Dockerfile . + docker push 728559092788.dkr.ecr.us-east-1.amazonaws.com/zenserver:${{ steps.read_version.outputs.content }}-linux + + create-release: + runs-on: [linux, x64, zen] + timeout-minutes: 5 + needs: [bundle-linux, bundle-macos, bundle-windows] + + steps: + - uses: actions/checkout@v4 + + - name: Read VERSION.txt + id: read_version + uses: ue-foundation/[email protected] + with: + path: "./VERSION.txt" + + - name: Get Sentry CLI + run: | + curl -sL https://sentry.io/get-cli/ | bash + ls -la ./scripts + env: + INSTALL_DIR: ./scripts + + - name: Create Release in Sentry + run: | + scripts/sentry-cli --auth-token ${{ secrets.SENTRY_API_KEY }} releases new --org to --project zen-server ${{steps.read_version.outputs.content}} + + - name: Download Linux artifacts + uses: actions/download-artifact@v3-node20 + with: + name: zenserver-linux + path: linux + + - name: Download MacOS artifacts + uses: actions/download-artifact@v3-node20 + with: + name: zenserver-macos + path: macos + + - name: Download Windows artifacts + uses: actions/download-artifact@v3-node20 + with: + name: zenserver-win64 + path: win64 + + - name: Extract Version Changes + run: | + sed '1,/^##/!d;/##/d' CHANGELOG.md > CHANGELOG.tmp + + - name: Read CHANGELOG.tmp + id: read_changelog + uses: ue-foundation/[email protected] + with: + path: "./CHANGELOG.tmp" + + - name: Check prerelease + id: get-prerelease + uses: ue-foundation/[email protected] + with: + cond: ${{contains(steps.read_version.outputs.content, '-pre')}} + if_true: "true" + if_false: "false" + + - name: Create Release + id: create_release + uses: ue-foundation/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{steps.read_version.outputs.content}} + target_commitish: ${{ github.sha }} + body: | + ${{steps.read_changelog.outputs.content}} + draft: false + prerelease: ${{steps.get-prerelease.outputs.value}} + files: | + linux/zenserver-linux.zip + win64/zenserver-win64.zip + macos/zenserver-macos.zip + + - name: Finalize Release in Sentry + run: | + scripts/sentry-cli --auth-token ${{ secrets.SENTRY_API_KEY }} releases finalize --org to --project zen-server ${{steps.read_version.outputs.content}} + + - name: Replicate release to public github + uses: ue-foundation/[email protected] + with: + token: ${{ secrets.ZEN_RELEASE_GITHUB_EE_TOKEN }} + src_repo: ue-foundation/zen + src_repo_github_api_url: https://api.github.ol.epicgames.net + + dest_token: ${{ secrets.ZEN_RELEASE_GITHUB_TOKEN }} + dest_repo: EpicGames/zen + dest_repo_github_api_url: https://api.github.com + + copy_assets: true + + # we generally expect to be up to date so we only replicate a few releases which should be the current one (plus potentially a few more) + limit: 3 + + # Working around issues with releases 5.5.2 and earlier that it attempts to replicate even though they already exist + min_version: v5.5.4 + + # we skip replicating pre and draft releases to keep the public repo focused on the releases itself + skip_prerelease: true + skip_draft: true |