fix: name of the dependencies base Docker image #229
This file contains 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: Default | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15.2-alpine | |
env: | |
POSTGRES_USER: serieslist | |
POSTGRES_PASSWORD: serieslist | |
POSTGRES_DB: serieslist_test | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# We need to fetch all branches and commits so that Nx affected has a base to compare against. | |
fetch-depth: 0 | |
- uses: nrwl/nx-set-shas@v3 | |
with: | |
main-branch-name: 'master' | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
cache: 'pnpm' | |
- name: Setup | |
run: | | |
cp .env.example .env | |
bash bin/generate-secret-token.sh | |
- name: Installing dependencies | |
env: | |
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
run: | | |
pnpm install | |
pnpm exec nx affected -t install-deps:e2e | |
- name: Checks | |
env: | |
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
run: | | |
pnpm exec nx affected -t migrate:test | |
pnpm exec nx affected -t migrate:e2e | |
pnpm exec nx affected -t lint,tsc,test:coverage --verbose | |
- name: E2E tests | |
env: | |
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
run: | | |
pnpm exec nx affected -t test:e2e | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: apps/e2e/playwright-report/ | |
retention-days: 30 | |
deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
url: https://serieslist.joosep.xyz | |
needs: check | |
if: ${{ github.ref == 'refs/heads/master' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# We need to fetch all branches and commits so that Nx affected has a base to compare against. | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: nrwl/nx-set-shas@v3 | |
with: | |
main-branch-name: 'master' | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
cache: 'pnpm' | |
- name: Expose GitHub Runtime | |
uses: crazy-max/ghaction-github-runtime@v3 | |
- name: Setup | |
run: | | |
cp .env.example .env | |
pnpm install | |
- name: Build containers | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
sed -i.bak -e "s/VITE_API_URL=.*/VITE_API_URL=https:\/\/api.serieslist.joosep.xyz/" .env | |
pnpm exec nx affected -t build:docker | |
- name: Install SSH Key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.DEPLOYMENT_SSH_PRIVATE_KEY }} | |
known_hosts: 'just-a-placeholder-so-we-dont-get-errors' | |
- name: Adding Known Hosts | |
run: ssh-keyscan -H ${{ secrets.DEPLOYMENT_SSH_HOST }} >> ~/.ssh/known_hosts | |
- name: Updating deployment in server | |
run: bash bin/update-deployment.sh | |
env: | |
DEPLOYMENT_SSH_HOST: ${{ secrets.DEPLOYMENT_SSH_HOST }} | |
DEPLOYMENT_SSH_USER: ${{ secrets.DEPLOYMENT_SSH_USER }} |