Deploy edu production through same-host Gitea runner
Deploy edu.mstaut.ir / deploy (push) Successful in 4m3s
Deploy edu.mstaut.ir / deploy (push) Successful in 4m3s
This commit is contained in:
1 parent
ef1ccea0ad
commit
8233dd8a24
6 files changed
+174
-5
No files matched your search
@@ -0,0 +1,35 @@
|
||||
name: Deploy edu.mstaut.ir
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: edu-production
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: local-host
|
||||
steps:
|
||||
- name: Checkout and deploy on the VPS
|
||||
env:
|
||||
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO_ACTOR: ${{ github.actor }}
|
||||
REPO_NAME: ${{ github.repository }}
|
||||
DEPLOY_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
TARGET=/opt/prod/Aut.ManagementFaculty
|
||||
mkdir -p "$TARGET"
|
||||
if [ ! -d "$TARGET/.git" ]; then
|
||||
git -C "$TARGET" init
|
||||
git -C "$TARGET" remote add origin "http://127.0.0.1:8301/$REPO_NAME.git"
|
||||
fi
|
||||
# Supply the job token only for fetch; never store it in .git/config.
|
||||
AUTH=$(printf '%s:%s' "$REPO_ACTOR" "$REPO_TOKEN" | base64 -w0)
|
||||
git -C "$TARGET" -c "http.extraHeader=Authorization: Basic $AUTH" fetch --depth=1 origin "$DEPLOY_SHA"
|
||||
unset AUTH REPO_TOKEN
|
||||
git -C "$TARGET" checkout --detach --force FETCH_HEAD
|
||||
bash "$TARGET/scripts/deploy-production.sh"
|
||||
Reference in new issue
Block a user