summaryrefslogtreecommitdiffci
path: root/.github/workflows/build-and-deploy.yml
diff options
from:
to:
context:
space:
mode:
authorGravatar SayaAndy <montferrat@tuta.io> 2025-08-16 22:56:19 +0700
committerGravatar SayaAndy <montferrat@tuta.io> 2025-08-16 22:56:19 +0700
commitc1fefa3e249e97e51f155cfb7276730c99b1cf44 (patch)
tree71dca2331c2cac8341f94b857863045f630a6635 /.github/workflows/build-and-deploy.yml
parentb1a1651ad7e7faf7a87aca8fea1cdad156f3606e (diff)
downloadweb-c1fefa3e249e97e51f155cfb7276730c99b1cf44.tar.gz
web-c1fefa3e249e97e51f155cfb7276730c99b1cf44.zip
feat: split deploy into 2 environments
fix: rm server exec in repo
Diffstat (limited to '.github/workflows/build-and-deploy.yml')
-rw-r--r--.github/workflows/build-and-deploy.yml77
1 files changed, 0 insertions, 77 deletions
diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml
deleted file mode 100644
index ac5fa1f..0000000
--- a/.github/workflows/build-and-deploy.yml
+++ /dev/null
@@ -1,77 +0,0 @@
-name: Publish Docker image
-on:
- push:
- tags:
- - "*"
-jobs:
- build-and-push:
- if: github.repository == 'SayaAndy/saya-today-web'
- runs-on: ubuntu-latest
- environment: Production
- permissions:
- packages: write
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - name: Generate output.css with tailwindcss
- uses: ZoeyVid/tailwindcss-update@main
- with:
- input: static/input.css
- output: static/output.css
- params: "--minify"
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v3
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
- - name: Login to GitHub Container Registry
- uses: docker/login-action@v3
- with:
- registry: ghcr.io
- username: ${{ github.repository_owner }}
- password: ${{ secrets.GHCR_TOKEN }}
- - name: Build and push
- uses: docker/build-push-action@v6
- with:
- context: .
- file: ./Dockerfile
- push: true
- tags: |
- ghcr.io/sayaandy/saya-today-web:latest
- ghcr.io/sayaandy/saya-today-web:${{ github.ref_name }}
-
- deploy:
- if: github.repository == 'SayaAndy/saya-today-web'
- runs-on: ubuntu-latest
- environment: Production
- needs: [build-and-push]
- steps:
- - name: Checkout
- uses: actions/checkout@v4
-
- - name: Set up SSH connection for pl.saya.today
- run: |
- mkdir -p ~/.ssh
- (cat <<EOF
- ${{ secrets.SVC_GITHUB_PK }}
- EOF
- ) > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
- sed -i 's/\r$//' ~/.ssh/id_ed25519
- ssh-keyscan -H pl.saya.today >> ~/.ssh/known_hosts
-
- - name: Test SSH connection
- run: |
- ssh -o ConnectTimeout=10 -i ~/.ssh/id_ed25519 svc_github@pl.saya.today "echo 'SSH connection successful'"
-
- - name: Install Ansible
- shell: bash
- run: |
- sudo apt update
- sudo apt install -y ansible
-
- - name: Run Ansible playbook
- env:
- ANSIBLE_HOST_KEY_CHECKING: False
- working-directory: ./deploy
- run: |
- ansible-playbook -i inventory.yml -l stage playbook.yml --private-key ~/.ssh/id_ed25519 -u svc_github -e saya_today_web_b2_key_id=${{ secrets.B2_KEY_ID }} -e saya_today_web_b2_application_key=${{ secrets.B2_APPLICATION_KEY }} -e saya_today_web_tag=${{ github.ref_name }}