Merge pull request #28 from Satisfactory-KMods/renovate/major-semanti… #115
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: Build, Push and Deploy | |
on: | |
push: | |
branches: | |
- '*' | |
- '!main' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
DOCKERNAME: dev-sfp-wiki | |
jobs: | |
prepare-and-build-app: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: lint and type check | |
run: | | |
cp .env.example .env | |
./installPngs.sh | |
pnpm add -g bun | |
pnpm i | |
bun run lint | |
rm .env | |
- name: Log into registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.PAT }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@7ce1a14667178c0e70ab8c6ae8db403145030669 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Deploy | |
uses: appleboy/[email protected] | |
with: | |
timeout: 60m | |
command_timeout: 60m | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_KEY }} | |
port: 22 | |
script: | | |
cd /home/apps/ | |
docker compose up -d --no-deps --pull always --build ${{ env.DOCKERNAME }} | |
docker image prune --force | |
sleep 600 | |
docker compose logs ${{ env.DOCKERNAME }} |