dev #9

Merged
Firq merged 33 commits from dev into main 2023-12-21 11:27:53 +00:00
Showing only changes of commit 69643c74f2 - Show all commits

View file

@ -2,18 +2,96 @@ on:
push: push:
tags: tags:
- '[0-9]+\.[0-9]+\.[0-9]+unlighthouse[0-9]+' - '[0-9]+\.[0-9]+\.[0-9]+unlighthouse[0-9]+'
- '[0-9]+\.[0-9]+\.[0-9]+ulh[0-9]+'
jobs: jobs:
unlighthouse: unlighthouse:
runs-on: docker runs-on: docker
container: registry.gitlab.com/gitlab-ci-utils/lighthouse:latest container: registry.gitlab.com/gitlab-ci-utils/lighthouse:latest
steps: steps:
- name: Checkout repository
uses: https://code.forgejo.org/actions/checkout@v3
- name: Install Dependencies - name: Install Dependencies
run: npm install @unlighthouse/cli puppeteer run: npm install @unlighthouse/cli puppeteer
- name: Run unlighthouse - name: Run unlighthouse
run: node_modules/.bin/unlighthouse-ci --site "https://preview.firq.dev/" run: node_modules/.bin/unlighthouse-ci --site "https://preview.firq.dev/"
- name: Prepare artifacts
run: cp serve.json unlighthouse-reports
- name: Upload reports - name: Upload reports
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: unlighthouse-reports name: unlighthouse-reports
path: unlighthouse-reports/ path: unlighthouse-reports/
deploy-unlighthouse-files:
needs: [ unlighthouse ]
runs-on: docker
env:
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
steps:
- name: Install and update ssh + rsync
run: |
which rsync || ( apt update -y && apt install rsync -y)
which ssh-agent || ( apt update -y && apt install openssh-client -y)
- name: Downloading static site artifacts
uses: actions/download-artifact@v3
with:
name: static-site
path: public
- name: Install SSH Key
uses: https://github.com/shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: unnecessary
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
- name: Stop screen session, delete old files
uses: https://github.com/appleboy/ssh-action@master
with:
host: ${{ env.DEPLOY_HOST }}
username: ${{ env.DEPLOY_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
screen -X -S firq_dev-unlighthouse kill
rm -r -f firq_dev/unlighthouse/*
- name: Copy files using rsync
run: rsync -az --stats public/* ${{ env.DEPLOY_USER }}@${{ env.DEPLOY_HOST }}:~/firq_dev/unlighthouse
- name: Check files on deploy target
uses: https://github.com/appleboy/ssh-action@master
with:
host: ${{ env.DEPLOY_HOST }}
username: ${{ env.DEPLOY_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd firq_dev
find public -maxdepth 1 -printf "%p\n"
deploy-unlighthouse-site:
needs: [ deploy-unlighthouse-files ]
runs-on: docker
env:
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
steps:
- name: Install and update ssh + rsync
run: |
which rsync || ( apt update -y && apt install rsync -y)
which ssh-agent || ( apt update -y && apt install openssh-client -y)
- name: Install SSH Key
uses: https://github.com/shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: unnecessary
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
- name: Start new screen session
uses: https://github.com/appleboy/ssh-action@master
with:
host: ${{ env.DEPLOY_HOST }}
username: ${{ env.DEPLOY_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
PATH="$HOME/.local/bin:$PATH"
cd fgo-firq_dev
screen -S firq_dev-unlighthouse -dm serve unlighthouse/ -p ${{ secrets.UNLIGHTHOUSE_DEPLOY_PORT }}