Skip to content

Player spawn locations #198

Player spawn locations

Player spawn locations #198

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js Client + Server build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- run: yarn install --frozen-lockfile
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build client
working-directory: ./packages/client
run: yarn build
- name: Build server
working-directory: ./packages/server
run: yarn build
- name: Run server tests
working-directory: ./packages/server
run: yarn test
- name: Do a server dry run
working-directory: ./packages/server
run: yarn dev --dry
- name: Upload server artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3.1.0
with:
name: server-${{ steps.vars.outputs.sha_short }}
path: ./packages/server/dist/
- name: Upload client artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3.1.0
with:
name: client-${{ steps.vars.outputs.sha_short }}
path: ./packages/client/dist/
docker-server:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set version string
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Store version to a file
run: echo "${{ steps.vars.outputs.sha_short }}" > ./packages/server/version.txt
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push server container - PR to main
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@v3
with:
context: ./
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/rts:server-pr-${{ steps.vars.outputs.sha_short }}
-
name: Build and push server container - main branch
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v3
with:
context: ./
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/rts:server, ${{ secrets.DOCKERHUB_USERNAME }}/rts:server-${{ steps.vars.outputs.sha_short }}