Skip to content

v1.1.0

v1.1.0 #21

Workflow file for this run

name: Release — Test, Build, Publish, Deploy
on:
release:
types: [published]
permissions:
contents: read
packages: write
env:
IMAGE_TAG: ${{ github.event.release.tag_name }}
jobs:
test-node:
name: Run node unit tests
runs-on: ubuntu-latest
strategy:
matrix:
service: [webapp, gateway, stats, auth_service]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: |
cd ${{ matrix.service }}
npm ci
- name: Run tests
run: |
cd ${{ matrix.service }}
npm test
test-rust:
name: Run rust (gamey) tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Run tests
run: |
cd gamey
cargo test
e2e:
name: Run E2E tests
runs-on: ubuntu-latest
needs: [test-node, test-rust]
services:
mongo-auth:
image: mongo:6.0
ports:
- 27017:27017
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install auth_service dependencies
run: |
cd auth_service
npm ci
- name: Install webapp dependencies
run: |
cd webapp
npm ci
- name: Install Playwright browsers
run: |
cd webapp
npm run test:e2e:install-browsers
- name: Run E2E tests (start servers and run cucumber)
env:
JWT_SECRET: e2e-test-secret
MONGO_AUTH_DB: mongodb://localhost:27017/auth
run: |
cd webapp
npm run test:e2e
docker-push-webapp:
name: Publish webapp image
runs-on: ubuntu-latest
needs: e2e
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish to Registry (webapp)
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{ github.repository_owner }}/${{ github.event.repository.name }}-webapp
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: webapp
docker-push-gateway:
name: Publish gateway image
runs-on: ubuntu-latest
needs: e2e
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish to Registry (gateway)
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{ github.repository_owner }}/${{ github.event.repository.name }}-gateway
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: gateway
docker-push-gamey:
name: Publish gamey image
runs-on: ubuntu-latest
needs: e2e
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish to Registry (gamey)
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{ github.repository_owner }}/${{ github.event.repository.name }}-gamey
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: gamey
docker-push-auth:
name: Publish auth image
runs-on: ubuntu-latest
needs: e2e
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish to Registry (auth)
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{ github.repository_owner }}/${{ github.event.repository.name }}-auth
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: auth_service
docker-push-stats:
name: Publish stats image
runs-on: ubuntu-latest
needs: e2e
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish to Registry (stats)
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{ github.repository_owner }}/${{ github.event.repository.name }}-stats
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: stats
deploy:
name: Deploy over SSH
runs-on: ubuntu-latest
needs: [docker-push-webapp, docker-push-gateway, docker-push-gamey, docker-push-auth, docker-push-stats]
steps:
- name: Deploy over SSH
uses: fifsky/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
user: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
command: |
wget https://raw.githubusercontent.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/master/docker-compose.yml -O docker-compose.yml
cat > .env << 'EOF'
JWT_SECRET=${{ secrets.JWT_SECRET }}
JWT_EXPIRES=${{ secrets.JWT_EXPIRES }}
MONGO_AUTH_DB=${{ secrets.MONGO_AUTH_DB }}
EOF
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker compose down
docker compose up -d --pull always