Create Release #539
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: "Create Release" | |
| on: | |
| workflow_run: | |
| workflows: ["Tag Release"] | |
| types: | |
| - completed | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| lfs: true | |
| ref: ${{ env.LATEST_TAG }} | |
| - name: Get the latest tag | |
| run: | | |
| git fetch --tags | |
| LATEST_TAG="$(git tag --sort=-creatordate | head -n 1)" | |
| echo "LATEST_TAG=${LATEST_TAG}" >> "$GITHUB_ENV" | |
| if [[ "$LATEST_TAG" == audience/* ]]; then | |
| echo "IS_AUDIENCE=true" >> "$GITHUB_ENV" | |
| else | |
| echo "IS_AUDIENCE=false" >> "$GITHUB_ENV" | |
| fi | |
| if [[ "$LATEST_TAG" == *alpha* ]]; then | |
| echo "IS_PRERELEASE=true" >> "$GITHUB_ENV" | |
| else | |
| echo "IS_PRERELEASE=false" >> "$GITHUB_ENV" | |
| fi | |
| - name: Pull LFS | |
| run: git lfs pull | |
| - name: Build Changelog | |
| id: github_release | |
| uses: mikepenz/release-changelog-builder-action@v3 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| configurationJson: | | |
| { | |
| "pr_template": "- #{{TITLE}} (##{{NUMBER}})", | |
| "categories": [ | |
| { | |
| "title": "## Features", | |
| "labels": ["feature", "feat"] | |
| }, | |
| { | |
| "title": "## Fixes", | |
| "labels": ["fix"] | |
| }, | |
| { | |
| "title": "## Performance", | |
| "labels": ["performance"] | |
| }, | |
| { | |
| "title": "## Documentation", | |
| "labels": ["docs"] | |
| }, | |
| { | |
| "title": "## Chores", | |
| "labels": ["chore"] | |
| } | |
| ] | |
| } | |
| - name: Extract TS SDK version from index.html | |
| if: env.IS_AUDIENCE != 'true' | |
| id: extract_ts_sdk_version | |
| run: | | |
| version=$(grep -oP '"x-sdk-version":"ts-immutable-sdk-\K[0-9]+\.[0-9]+\.[0-9]+' ./src/Packages/Passport/Runtime/Resources/index.html | head -n 1) | |
| if [[ -z "$version" ]]; then | |
| echo "Error: Version not found in index.html" >&2 | |
| exit 1 | |
| fi | |
| version=$(echo "$version" | tr -d '\r\n') | |
| echo "TS_SDK_VERSION=${version}" >> "$GITHUB_ENV" | |
| - name: Build release body suffix | |
| run: | | |
| if [[ "$IS_AUDIENCE" != "true" && -n "$TS_SDK_VERSION" ]]; then | |
| echo "RELEASE_BODY_SUFFIX=Game bridge built from Immutable Typescript SDK version $TS_SDK_VERSION" >> "$GITHUB_ENV" | |
| else | |
| echo "RELEASE_BODY_SUFFIX=" >> "$GITHUB_ENV" | |
| fi | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ env.LATEST_TAG }} | |
| release_name: ${{ env.LATEST_TAG }} | |
| body: | | |
| ${{steps.github_release.outputs.changelog}} | |
| ${{ env.RELEASE_BODY_SUFFIX }} | |
| draft: false | |
| prerelease: ${{ env.IS_PRERELEASE }} |