50 lines
2.0 KiB
YAML
50 lines
2.0 KiB
YAML
name: Deploy Canina
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- develop
|
|
- release/blog-timestamp-limited-20261030
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: canina
|
|
steps:
|
|
- name: Run deploy.sh from within the scripts folder
|
|
env:
|
|
DEPLOY_REF: ${{ github.ref }}
|
|
DEPLOY_SHA: ${{ github.sha }}
|
|
GITHUB_ACTIONS: 'true'
|
|
run: |
|
|
set -eu
|
|
case "${DEPLOY_REF}" in
|
|
refs/heads/main) BRANCH=main; STAGE_SOURCE_REF= ;;
|
|
refs/heads/develop|refs/heads/release/blog-timestamp-limited-20261030)
|
|
BRANCH=develop; STAGE_SOURCE_REF="$DEPLOY_REF" ;;
|
|
*) printf 'Unsupported deployment ref\n' >&2; exit 2 ;;
|
|
esac
|
|
# Bind downloads and both release dispatchers to the exact event commit.
|
|
case "$DEPLOY_SHA" in
|
|
*[!0-9a-f]*|'') exit 2 ;;
|
|
esac
|
|
[ "${#DEPLOY_SHA}" -eq 40 ] || exit 2
|
|
export BRANCH STAGE_SOURCE_REF
|
|
# 1. رفع مشکل DNS و غیرفعال کردن پروکسی برای دامنه محلی
|
|
echo "87.248.133.138 git.parsaaghayi.ir" >> /etc/hosts
|
|
export http_proxy=""
|
|
export https_proxy=""
|
|
export HTTP_PROXY=""
|
|
export HTTPS_PROXY=""
|
|
export no_proxy="git.parsaaghayi.ir,localhost,127.0.0.1,87.248.133.138"
|
|
|
|
# 2. دانلود و اجرای اسکریپت deploy.sh بر اساس برنچ جاری
|
|
mkdir -p scripts
|
|
wget --no-proxy -qO scripts/deploy.sh https://git.parsaaghayi.ir/parsa/canina/raw/commit/${DEPLOY_SHA}/scripts/deploy.sh
|
|
wget --no-proxy -qO scripts/release-cache-stage.sh https://git.parsaaghayi.ir/parsa/canina/raw/commit/${DEPLOY_SHA}/scripts/release-cache-stage.sh
|
|
|
|
wget --no-proxy -qO scripts/release-cache-prod.sh https://git.parsaaghayi.ir/parsa/canina/raw/commit/${DEPLOY_SHA}/scripts/release-cache-prod.sh
|
|
chmod +x scripts/deploy.sh
|
|
cd scripts
|
|
./deploy.sh "${BRANCH}"
|