38 lines
1017 B
YAML
38 lines
1017 B
YAML
name: build
|
|
on:
|
|
push:
|
|
branches: [main, staging]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
registry: git.stanrunge.dev
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./packages/web
|
|
push: true
|
|
tags: git.stanrunge.dev/stan/personal-website:${{ github.sha }}
|
|
|
|
deploy:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: setup key
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
ssh-keyscan -H 172.17.0.1 >> ~/.ssh/known_hosts
|
|
|
|
- name: deploy
|
|
run: |
|
|
ssh deploy@172.17.0.1 "echo IMAGE_TAG=${{ github.sha }} | sudo tee /opt/personal-website/.env && cd /opt/personal-website && sudo docker compose -f compose.prod.yml up -d"
|