7f06856f45
build-and-deploy / deploy (push) Successful in 10m50s
Blazor UI + ASP.NET API + Postgres; push to main builds images and rolls out namespace tafsirquran.
56 lines
1.8 KiB
YAML
56 lines
1.8 KiB
YAML
name: build-and-deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: deploy
|
|
steps:
|
|
- name: Sync workspace from Gitea
|
|
env:
|
|
GITEA_TOKEN: ${{ github.token }}
|
|
run: |
|
|
set -euo pipefail
|
|
REPO="${GITHUB_REPOSITORY}"
|
|
SHA="${GITHUB_SHA}"
|
|
BRANCH="${GITHUB_REF_NAME:-main}"
|
|
TOKEN="${GITEA_TOKEN:-}"
|
|
if [ -n "$TOKEN" ]; then
|
|
REPO_URL="http://oauth2:${TOKEN}@127.0.0.1:30080/${REPO}.git"
|
|
else
|
|
REPO_URL="http://127.0.0.1:30080/${REPO}.git"
|
|
fi
|
|
WORK="${GITHUB_WORKSPACE:-$PWD}"
|
|
mkdir -p "$WORK"
|
|
cd "$WORK"
|
|
echo "workspace=$WORK repo=$REPO branch=$BRANCH sha=$SHA"
|
|
rm -rf ./* ./.[!.]* ./.git 2>/dev/null || true
|
|
git init
|
|
git remote add origin "$REPO_URL"
|
|
if ! git fetch --depth 50 origin "$SHA"; then
|
|
git fetch --depth 50 origin "+refs/heads/${BRANCH}:refs/remotes/origin/${BRANCH}"
|
|
fi
|
|
git checkout --force "$SHA"
|
|
test "$(git rev-parse HEAD)" = "$SHA"
|
|
git log -1 --oneline
|
|
test -f scripts/cicd-deploy.sh
|
|
chmod +x scripts/cicd-deploy.sh
|
|
|
|
- name: Build images and roll out to k3s
|
|
env:
|
|
HTTP_PROXY: http://46.249.98.211:3128
|
|
HTTPS_PROXY: http://46.249.98.211:3128
|
|
http_proxy: http://46.249.98.211:3128
|
|
https_proxy: http://46.249.98.211:3128
|
|
NO_PROXY: 127.0.0.1,localhost,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
|
|
no_proxy: 127.0.0.1,localhost,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
|
|
NS: tafsirquran
|
|
PUBLIC_WEB: http://185.252.31.44:30820
|
|
PUBLIC_API: http://185.252.31.44:30821
|
|
run: |
|
|
set -euo pipefail
|
|
./scripts/cicd-deploy.sh
|