testing with dockerfile
All checks were successful
/ checking (push) Successful in 44s

This commit is contained in:
Firq 2023-12-20 20:32:02 +01:00
parent b72228ce36
commit 8e88fd8597
Signed by: Firq
GPG key ID: 4DE1059A4666E89F
7 changed files with 83 additions and 151 deletions

View file

@ -0,0 +1,49 @@
on:
push:
tags:
- "\d+\.\d+\.\d+(?:(?:a|b|rc)\d+)?"
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
- 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:latest
release:
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 }}

View file

@ -1,110 +0,0 @@
on:
push:
branches:
- main
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]
runs-on: docker
container: node:lts
steps:
- name: Checkout checked source code
uses: https://code.forgejo.org/actions/checkout@v3
- name: Install required packages
run: npm install
- name: Build static site
run: npm run build
- name: Delete unnecessary data files
run: rm -r public/assets/data/
- name: Copy missing config for binserve
run: cp serve.json public
- name: Save site artifact as static-site
uses: https://code.forgejo.org/actions/upload-artifact@v3
with:
name: static-site
path: public/
deploy-files:
needs: [ build-site ]
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 fgo-ta_com-public kill
rm -r -f fgo-ta_com/public/*
- name: Copy files using rsync
run: rsync -az --stats public/* ${{ env.DEPLOY_USER }}@${{ env.DEPLOY_HOST }}:~/fgo-ta_com/public
- 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 public -maxdepth 1 -printf "%p\n"
deploy-site:
needs: [ deploy-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-public -dm serve public/ -p ${{ secrets.DEPLOY_TARGET_PORT }}

View file

@ -0,0 +1,16 @@
on:
push:
branches:
- "**"
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

View file

@ -1,31 +0,0 @@
on: workflow_dispatch
jobs:
redeploy-site:
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: Restart 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: |
screen -X -S fgo-ta_com-public kill
PATH="$HOME/.local/bin:$PATH"
cd fgo-ta_com
screen -S fgo-ta_com-public -dm serve public/ -p ${{ secrets.DEPLOY_TARGET_PORT }}

View file

@ -6,7 +6,8 @@
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/__pycache__": true
"**/__pycache__": true,
"**/node_modules": false
},
"hide-files.files": []
}

16
Dockerfile Normal file
View file

@ -0,0 +1,16 @@
FROM node:lts AS build
WORKDIR /app
COPY . .
RUN npm i
RUN npm run build
FROM node:lts AS runtime
RUN npm install --global "@warren-bank/serve"
COPY --from=build /app/dist /public
COPY --from=build /app/serve.json /public/serve.json
ENV PORT 5000
EXPOSE 5000
CMD [ "serve" "public/" "-p" "5000" ]

View file

@ -1,9 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128">
<path d="M50.4 78.5a75.1 75.1 0 0 0-28.5 6.9l24.2-65.7c.7-2 1.9-3.2 3.4-3.2h29c1.5 0 2.7 1.2 3.4 3.2l24.2 65.7s-11.6-7-28.5-7L67 45.5c-.4-1.7-1.6-2.8-2.9-2.8-1.3 0-2.5 1.1-2.9 2.7L50.4 78.5Zm-1.1 28.2Zm-4.2-20.2c-2 6.6-.6 15.8 4.2 20.2a17.5 17.5 0 0 1 .2-.7 5.5 5.5 0 0 1 5.7-4.5c2.8.1 4.3 1.5 4.7 4.7.2 1.1.2 2.3.2 3.5v.4c0 2.7.7 5.2 2.2 7.4a13 13 0 0 0 5.7 4.9v-.3l-.2-.3c-1.8-5.6-.5-9.5 4.4-12.8l1.5-1a73 73 0 0 0 3.2-2.2 16 16 0 0 0 6.8-11.4c.3-2 .1-4-.6-6l-.8.6-1.6 1a37 37 0 0 1-22.4 2.7c-5-.7-9.7-2-13.2-6.2Z" />
<style>
path { fill: #000; }
@media (prefers-color-scheme: dark) {
path { fill: #FFF; }
}
</style>
</svg>

Before

Width:  |  Height:  |  Size: 749 B