v4.0.0-beta.21 #362
Workflow file for this run
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: Release | |
| on: | |
| release: | |
| types: | |
| - published | |
| push: | |
| branches: | |
| - dev | |
| - test | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| release: | |
| if: ${{ github.event_name == 'release' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: "npm" | |
| cache-dependency-path: package-lock.json | |
| - name: Pin npm | |
| run: | | |
| corepack enable | |
| corepack prepare npm@11.8.0 --activate | |
| npm -v | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Run tests | |
| run: npm test | |
| - name: Define release build metadata | |
| id: release_meta | |
| shell: bash | |
| run: | | |
| TAG="${{ github.event.release.tag_name }}" | |
| VERSION="${TAG#v}" | |
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "prerelease=${{ github.event.release.prerelease }}" >> "$GITHUB_OUTPUT" | |
| # Ahead of the image on purpose: this needs dist/ from Build and the tag from | |
| # the step above, nothing from Docker — so the bundle is on the release in a | |
| # minute instead of after the multi-arch build. | |
| # Server-core self-update bundle consumed by POST /admin/api/server/update. | |
| # dist/ is pure JS (arch-agnostic); node_modules is rebuilt on the target via | |
| # npm ci, so a single tarball + the manifests is enough. public/ is excluded — | |
| # the admin UI and player ship as their own bundles. | |
| - name: Package server-dist bundle | |
| shell: bash | |
| run: | | |
| tar -czf server-dist.tgz dist package.json package-lock.json | |
| ls -lh server-dist.tgz | |
| - name: Attach server-dist bundle to release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh release upload "${{ steps.release_meta.outputs.tag }}" server-dist.tgz --clobber | |
| - name: Define Docker tags | |
| id: tags | |
| shell: bash | |
| run: | | |
| if [ "${{ steps.release_meta.outputs.prerelease }}" = "true" ]; then | |
| echo "tags=ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.release_meta.outputs.version }},ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:beta,ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:beta-latest" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "tags=ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.release_meta.outputs.version }},ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.tags.outputs.tags }} | |
| build-args: | | |
| BUILD_VERSION=${{ steps.release_meta.outputs.version }} | |
| BUILD_CHANNEL=${{ steps.release_meta.outputs.prerelease == 'true' && 'beta' || 'stable' }} | |
| dev: | |
| if: ${{ github.ref_name == 'dev' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: "npm" | |
| cache-dependency-path: package-lock.json | |
| - name: Pin npm | |
| run: | | |
| corepack enable | |
| corepack prepare npm@11.8.0 --activate | |
| npm -v | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Run tests | |
| run: npm test | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Define dev build metadata | |
| id: dev_meta | |
| shell: bash | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| BUILD_TS=$(date -u +%Y%m%d%H%M%S) | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "build_id=dev-$BUILD_TS" >> "$GITHUB_OUTPUT" | |
| - name: Build and push Docker image (dev) | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:dev,ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:dev-latest | |
| build-args: | | |
| BUILD_VERSION=${{ steps.dev_meta.outputs.version }} | |
| BUILD_TIMESTAMP=${{ steps.dev_meta.outputs.build_id }} | |
| BUILD_CHANNEL=dev | |
| test: | |
| if: ${{ github.ref_name == 'test' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: "npm" | |
| cache-dependency-path: package-lock.json | |
| - name: Pin npm | |
| run: | | |
| corepack enable | |
| corepack prepare npm@11.8.0 --activate | |
| npm -v | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Run tests | |
| run: npm test | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Define test build metadata | |
| id: test_meta | |
| shell: bash | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| BUILD_TS=$(date -u +%Y%m%d%H%M%S) | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "build_id=testing-$BUILD_TS" >> "$GITHUB_OUTPUT" | |
| - name: Build and push Docker image (testing) | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:testing,ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:testing-latest | |
| build-args: | | |
| BUILD_VERSION=${{ steps.test_meta.outputs.version }} | |
| BUILD_TIMESTAMP=${{ steps.test_meta.outputs.build_id }} | |
| BUILD_CHANNEL=testing |