56 lines
1.7 KiB
YAML
56 lines
1.7 KiB
YAML
name: Salon 生产发布准备
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- closed
|
|
branches:
|
|
- prod
|
|
|
|
jobs:
|
|
prepare:
|
|
if: >-
|
|
github.event.pull_request.merged == true &&
|
|
github.event.pull_request.base.ref == 'prod' &&
|
|
github.event.pull_request.head.ref == 'sit'
|
|
runs-on: jayucloud
|
|
env:
|
|
GITHUB_REF_NAME: prod
|
|
GITHUB_SERVER_URL: http://192.168.5.15:3000
|
|
steps:
|
|
- name: 从内网 Gitea 检出合并提交
|
|
shell: bash
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
CHECKOUT_SHA: ${{ github.event.pull_request.merge_commit_sha }}
|
|
run: |
|
|
set -euo pipefail
|
|
test -n "$GITEA_TOKEN"
|
|
test -n "$CHECKOUT_SHA"
|
|
git init .
|
|
git remote add origin "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git"
|
|
git -c http.extraheader="Authorization: token $GITEA_TOKEN" fetch --no-tags --depth=1 origin "$CHECKOUT_SHA"
|
|
git checkout --detach "$CHECKOUT_SHA"
|
|
- name: 检查构建工具链
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
java -version 2>&1 | grep -q '17\.'
|
|
node --version | grep -q '^v20\.'
|
|
mvn --version > "$RUNNER_TEMP/maven-version.txt"
|
|
grep -q 'Java version: 17\.' "$RUNNER_TEMP/maven-version.txt"
|
|
pwsh --version
|
|
- name: 构建 Salon 发布包
|
|
shell: pwsh
|
|
run: >-
|
|
./docs/scripts/deploy-jayucloud-salon-production.ps1
|
|
-PackageOnly
|
|
-SkipDatabaseInit
|
|
- name: 上传发布包
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: salon-prod-${{ github.event.pull_request.merge_commit_sha }}
|
|
path: artifacts/release/*
|
|
if-no-files-found: error
|
|
retention-days: 30
|