forked from github.com/GenderDysphoria.fyi
test ci
This commit is contained in:
@@ -7,11 +7,11 @@ on:
|
||||
# - "templates/**"
|
||||
branches:
|
||||
- "master"
|
||||
- "gdb.lgbtqi.app-production"
|
||||
- "ci-testing"
|
||||
|
||||
jobs:
|
||||
job1:
|
||||
name: Build static site, docker image, upload artifact...
|
||||
name: Build static site.
|
||||
runs-on: catthehacker-ubuntu
|
||||
steps:
|
||||
-
|
||||
@@ -21,48 +21,18 @@ jobs:
|
||||
-
|
||||
name: Checkout the git repo...
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: master
|
||||
-
|
||||
name: Set up docker buildx...
|
||||
uses: docker/setup-buildx-action@v3
|
||||
-
|
||||
name: Login to gitea registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.raer.me
|
||||
username: ${{ secrets.PRODUCTION_REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.PRODUCTION_REGISTRY_TOKEN }}
|
||||
-
|
||||
name: Install required system packages...
|
||||
run: |
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt update
|
||||
apt upgrade -y
|
||||
apt install -y curl tar p7zip-full graphicsmagick
|
||||
apt install -y curl graphicsmagick
|
||||
-
|
||||
name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'npm'
|
||||
-
|
||||
name: Restore node_modules cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node_modules
|
||||
-
|
||||
name: Restore Asset Cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
key: if-cache
|
||||
path: |
|
||||
./if-cache/*
|
||||
./if-cache.json
|
||||
./twitter-cache.json
|
||||
-
|
||||
name: Install node dependencies
|
||||
run: npm ci
|
||||
@@ -72,73 +42,58 @@ jobs:
|
||||
-
|
||||
name: Build site
|
||||
run: npm run build
|
||||
-
|
||||
name: Create artifact...
|
||||
run: 7z a -mx=9 ./artifact.7z dist
|
||||
-
|
||||
name: Upload artifact...
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifact_${{ steps.date.outputs.date }}
|
||||
path: ./artifact.7z
|
||||
name: build_artifact
|
||||
path: dist
|
||||
retention-days: 7
|
||||
-
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: gdb.lgbtqi.app-production
|
||||
-
|
||||
name: Build and push docker image to gitea package store
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64
|
||||
tags: gitea.raer.me/${{ gitea.repository }}:${{ gitea.ref_name }}
|
||||
job2:
|
||||
needs: job1
|
||||
name: Connect to deployment host, update, and redeploy docs website.
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Install required system packages...
|
||||
run: |
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt update
|
||||
apt upgrade -y
|
||||
apt install -y iputils-ping
|
||||
-
|
||||
name: Configure SSH...
|
||||
env:
|
||||
SSH_USER: ${{ secrets.PRODUCTION_SSH_USER }}
|
||||
SSH_KEY: ${{ secrets.PRODUCTION_SSH_KEY }}
|
||||
SSH_HOST: ${{ secrets.PRODUCTION_SSH_HOST }}
|
||||
run: |
|
||||
mkdir -p ~/.ssh/
|
||||
echo "$SSH_KEY" > ~/.ssh/staging.key
|
||||
chmod 600 ~/.ssh/staging.key
|
||||
cat >> ~/.ssh/config <<END
|
||||
Host staging
|
||||
HostName $SSH_HOST
|
||||
User $SSH_USER
|
||||
IdentityFile ~/.ssh/staging.key
|
||||
StrictHostKeyChecking no
|
||||
END
|
||||
cat ~/.ssh/config
|
||||
-
|
||||
name: Test SSH Host...
|
||||
env:
|
||||
SSH_HOST: ${{ secrets.PRODUCTION_SSH_HOST }}
|
||||
run: |
|
||||
ping -c 3 $SSH_HOST
|
||||
ssh staging 'ls'
|
||||
-
|
||||
name: Pull new image and redeploy...
|
||||
run: |
|
||||
ssh staging '\
|
||||
echo "${{ secrets.PRODUCTION_REGISTRY_TOKEN }}" | docker login --password-stdin --username ${{ secrets.PRODUCTION_REGISTRY_USERNAME }} gitea.raer.me; \
|
||||
docker stop gdb.lgbtqi.app; \
|
||||
docker rm gdb.lgbtqi.app; \
|
||||
docker pull gitea.raer.me/${{ gitea.repository }}:${{ gitea.ref_name }}; \
|
||||
docker run -d --name gdb.lgbtqi.app -p ${{ secrets.PRODUCTION_DEPLOYMENT_HOST }}:4100:80 gitea.raer.me/${{ gitea.repository }}:${{ gitea.ref_name }}; \
|
||||
docker logout gitea.raer.me;'
|
||||
# job2:
|
||||
# needs: job1
|
||||
# name: Connect to deployment host, update, and redeploy docs website.
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# -
|
||||
# name: Install required system packages...
|
||||
# run: |
|
||||
# export DEBIAN_FRONTEND=noninteractive
|
||||
# apt update
|
||||
# apt upgrade -y
|
||||
# apt install -y iputils-ping
|
||||
# -
|
||||
# name: Configure SSH...
|
||||
# env:
|
||||
# SSH_USER: ${{ secrets.PRODUCTION_SSH_USER }}
|
||||
# SSH_KEY: ${{ secrets.PRODUCTION_SSH_KEY }}
|
||||
# SSH_HOST: ${{ secrets.PRODUCTION_SSH_HOST }}
|
||||
# run: |
|
||||
# mkdir -p ~/.ssh/
|
||||
# echo "$SSH_KEY" > ~/.ssh/staging.key
|
||||
# chmod 600 ~/.ssh/staging.key
|
||||
# cat >> ~/.ssh/config <<END
|
||||
# Host staging
|
||||
# HostName $SSH_HOST
|
||||
# User $SSH_USER
|
||||
# IdentityFile ~/.ssh/staging.key
|
||||
# StrictHostKeyChecking no
|
||||
# END
|
||||
# cat ~/.ssh/config
|
||||
# -
|
||||
# name: Test SSH Host...
|
||||
# env:
|
||||
# SSH_HOST: ${{ secrets.PRODUCTION_SSH_HOST }}
|
||||
# run: |
|
||||
# ping -c 3 $SSH_HOST
|
||||
# ssh staging 'ls'
|
||||
# -
|
||||
# name: Pull new image and redeploy...
|
||||
# run: |
|
||||
# ssh staging '\
|
||||
# echo "${{ secrets.PRODUCTION_REGISTRY_TOKEN }}" | docker login --password-stdin --username ${{ secrets.PRODUCTION_REGISTRY_USERNAME }} gitea.raer.me; \
|
||||
# docker stop gdb.lgbtqi.app; \
|
||||
# docker rm gdb.lgbtqi.app; \
|
||||
# docker pull gitea.raer.me/${{ gitea.repository }}:${{ gitea.ref_name }}; \
|
||||
# docker run -d --name gdb.lgbtqi.app -p ${{ secrets.PRODUCTION_DEPLOYMENT_HOST }}:4100:80 gitea.raer.me/${{ gitea.repository }}:${{ gitea.ref_name }}; \
|
||||
# docker logout gitea.raer.me;'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user