cleaned up actions script
All checks were successful
Publish Website / publish (push) Successful in 28s
All checks were successful
Publish Website / publish (push) Successful in 28s
This commit is contained in:
@@ -4,7 +4,7 @@ run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ] # <- typo fixed (“braches” → “branches”)
|
branches: [ main ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
@@ -16,61 +16,38 @@ jobs:
|
|||||||
image: docker:28.2-dind
|
image: docker:28.2-dind
|
||||||
command: ["--storage-driver=overlay2", "--tls=false"]
|
command: ["--storage-driver=overlay2", "--tls=false"]
|
||||||
steps:
|
steps:
|
||||||
# 1. Checkout the website repository (your app code)
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
- name: Checkout website repo
|
- name: Checkout website repo
|
||||||
run: git clone http://gitea:3000/lepton/website
|
run: git clone http://gitea:3000/lepton/website
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# 2. Start an SSH agent and load the private key from secrets
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
- name: Set up SSH agent
|
- name: Set up SSH agent
|
||||||
env:
|
env:
|
||||||
SSH_KEY: ${{ secrets.ACCESS_KEY }} # your private key
|
SSH_KEY: ${{ secrets.ACCESS_KEY }}
|
||||||
#shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
eval "$(ssh-agent -s)"
|
eval "$(ssh-agent -s)"
|
||||||
mkdir ~/.ssh
|
mkdir ~/.ssh
|
||||||
echo "$SSH_KEY" >> ~/.ssh/id_rsa
|
echo "$SSH_KEY" >> ~/.ssh/id_rsa
|
||||||
chmod 400 ~/.ssh/id_rsa
|
chmod 400 ~/.ssh/id_rsa
|
||||||
ssh-add ~/.ssh/id_rsa
|
ssh-add ~/.ssh/id_rsa
|
||||||
# ------------------------------------------------------------
|
|
||||||
# 3. Trust the Gitea host key (port 222)
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
- name: Trust Gitea host key
|
- name: Trust Gitea host key
|
||||||
#shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
ssh-keyscan -H gitea 2>/dev/null >> ~/.ssh/known_hosts
|
ssh-keyscan -H gitea 2>/dev/null >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# 4. Clone the template repo via SSH (uses detected IP + port 222)
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
- name: Clone template repo
|
- name: Clone template repo
|
||||||
#shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
git clone ssh://git@gitea/lepton/app_templates /tmp/template
|
git clone ssh://git@gitea/lepton/app_templates /tmp/template
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# 5. Copy Docker artefacts into workspace root
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
- name: Copy Docker configuration
|
- name: Copy Docker configuration
|
||||||
#shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
cp /tmp/template/web/docker-compose.yml ./website/docker-compose.yml
|
cp /tmp/template/web/docker-compose.yml ./website/docker-compose.yml
|
||||||
cp /tmp/template/web/Dockerfile ./website/Dockerfile
|
cp /tmp/template/web/Dockerfile ./website/Dockerfile
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# 6. Stop any old stack, rebuild, and run the new one
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
- name: Stop existing stack (ignore if none)
|
- name: Stop existing stack (ignore if none)
|
||||||
#shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
cd ./website
|
cd ./website
|
||||||
docker compose down --remove-orphans || true
|
docker compose down --remove-orphans || true
|
||||||
# Add this line to forcefully remove the container if it still exists
|
# Add this line to forcefully remove the container if it still exists
|
||||||
docker rm -f website || true # `|| true` to prevent step failure if container doesn't exist
|
docker rm -f website || true # `|| true` to prevent step failure if container doesn't exist
|
||||||
- name: Rebuild & deploy
|
- name: Rebuild & deploy
|
||||||
#shell: bash
|
|
||||||
working-directory: website
|
working-directory: website
|
||||||
run: |
|
run: |
|
||||||
docker compose build --no-cache
|
docker compose build --no-cache
|
||||||
|
Reference in New Issue
Block a user