summaryrefslogtreecommitdiff
path: root/.github/workflows
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build-and-deploy.yml37
1 files changed, 13 insertions, 24 deletions
diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml
index ac5fa1f..57cfc96 100644
--- a/.github/workflows/build-and-deploy.yml
+++ b/.github/workflows/build-and-deploy.yml
@@ -8,8 +8,6 @@ jobs:
if: github.repository == 'SayaAndy/saya-today-web'
runs-on: ubuntu-latest
environment: Production
- permissions:
- packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -20,17 +18,17 @@ jobs:
output: static/output.css
params: "--minify"
- name: Set up QEMU
- uses: docker/setup-qemu-action@v3
+ uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
+ uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
- uses: docker/login-action@v3
+ uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push
- uses: docker/build-push-action@v6
+ uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
@@ -47,31 +45,22 @@ jobs:
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
+ - name: Set up SSH private key
run: |
- ssh -o ConnectTimeout=10 -i ~/.ssh/id_ed25519 svc_github@pl.saya.today "echo 'SSH connection successful'"
-
+ echo "${{ secrets.SVC_GITHUB_PK }}" > deploy/private_key.pem
+ chmod 600 deploy/private_key.pem
- 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 }}
+ run: >
+ ansible-playbook -i inventory.yml -l stage playbook.yml
+ --private-key private_key.pem
+ -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 }}