Added preview + unlighthosue
This commit is contained in:
parent
d08a7e86c7
commit
fc93ddaa75
3 changed files with 148 additions and 1 deletions
53
.forgejo/workflows/build_preview.yml
Normal file
53
.forgejo/workflows/build_preview.yml
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '[0-9]+\.[0-9]+\.[0-9]+pre[0-9]+'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
checking:
|
||||||
|
runs-on: docker
|
||||||
|
container: node:lts
|
||||||
|
steps:
|
||||||
|
- name: Checkout source code
|
||||||
|
uses: https://code.forgejo.org/actions/checkout@v3
|
||||||
|
- name: Install packages
|
||||||
|
run: npm install
|
||||||
|
- name: Run astro check (linting + static analysis)
|
||||||
|
run: npm run astro check
|
||||||
|
|
||||||
|
build-site:
|
||||||
|
needs: [checking]
|
||||||
|
if: success()
|
||||||
|
runs-on: dind
|
||||||
|
steps:
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
config-inline: |
|
||||||
|
[registry."docker.io"]
|
||||||
|
mirrors = ["https://docker-cache.neshweb.net"]
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: forgejo.neshweb.net
|
||||||
|
username: ${{ secrets.FORGEJO_USERNAME }}
|
||||||
|
password: ${{ secrets.FORGEJO_TOKEN }}
|
||||||
|
- name: Push to Package Registry
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: forgejo.neshweb.net/firq/fgo-ta-com-website:${{ github.ref_name }}, forgejo.neshweb.net/firq/fgo-ta-com-website:preview
|
||||||
|
|
||||||
|
publish:
|
||||||
|
needs: [build-site]
|
||||||
|
if: success()
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- name: Release New Version
|
||||||
|
uses: actions/forgejo-release@v1
|
||||||
|
with:
|
||||||
|
direction: upload
|
||||||
|
url: https://forgejo.neshweb.net
|
||||||
|
release-dir: release
|
||||||
|
token: ${{ secrets.FORGEJO_TOKEN }}
|
||||||
|
tag: ${{ github.ref_name }}
|
|
@ -2,7 +2,6 @@ on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- '[0-9]+\.[0-9]+\.[0-9]+'
|
- '[0-9]+\.[0-9]+\.[0-9]+'
|
||||||
- '[0-9]+\.[0-9]+\.[0-9]+pre[0-9]+'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
checking:
|
checking:
|
||||||
|
|
95
.forgejo/workflows/unlighthouse.yml
Normal file
95
.forgejo/workflows/unlighthouse.yml
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '[0-9]+\.[0-9]+\.[0-9]+unlighthouse[0-9]+'
|
||||||
|
- '[0-9]+\.[0-9]+\.[0-9]+ulh[0-9]+'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
unlighthouse:
|
||||||
|
runs-on: docker
|
||||||
|
container: forgejo.neshweb.net/ci-docker-images/unlighthouse:latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: https://code.forgejo.org/actions/checkout@v3
|
||||||
|
- name: Run unlighthouse
|
||||||
|
run: unlighthouse-ci --site "https://preview.fgo-ta.com/"
|
||||||
|
- name: Prepare artifacts
|
||||||
|
run: cp serve.json unlighthouse-reports
|
||||||
|
- name: Upload reports
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: 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: unlighthouse-reports
|
||||||
|
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 fgo_ta_com-unlighthouse kill
|
||||||
|
rm -r -f fgo_ta_com/unlighthouse/*
|
||||||
|
- name: Copy files using rsync
|
||||||
|
run: rsync -az --stats public/* ${{ env.DEPLOY_USER }}@${{ env.DEPLOY_HOST }}:~/fgo_ta_com/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 fgo_ta_com
|
||||||
|
find unlighthouse -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_ta_com
|
||||||
|
screen -S fgo_ta_com-unlighthouse -dm serve unlighthouse/ -p ${{ secrets.UNLIGHTHOUSE_DEPLOY_PORT }}
|
Loading…
Reference in a new issue