Update deploy.yml
This commit is contained in:
1 parent
7b126b58e3
commit
98b9584b97
1 file changed
+34
-27
@@ -358,15 +358,28 @@ jobs:
|
|||||||
id: start-edgeone
|
id: start-edgeone
|
||||||
run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT
|
run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Get build hash from COS (public URL)
|
- name: Setup Python
|
||||||
id: hash
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install coscmd
|
||||||
|
run: pip install -U coscmd
|
||||||
|
|
||||||
|
- name: Configure coscmd
|
||||||
env:
|
env:
|
||||||
|
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
|
||||||
|
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
|
||||||
COS_BUCKET: ${{ secrets.COS_BUCKET }}
|
COS_BUCKET: ${{ secrets.COS_BUCKET }}
|
||||||
COS_REGION: ${{ secrets.COS_REGION }}
|
COS_REGION: ${{ secrets.COS_REGION }}
|
||||||
|
run: coscmd config -a $COS_SECRET_ID -s $COS_SECRET_KEY -b $COS_BUCKET -r $COS_REGION
|
||||||
|
|
||||||
|
- name: Get build hash from COS
|
||||||
|
id: hash
|
||||||
run: |
|
run: |
|
||||||
COS_URL="https://${COS_BUCKET}.cos.${COS_REGION}.myqcloud.com/__build_hash"
|
|
||||||
echo "🔍 从腾讯云 COS 获取上次部署的 hash..."
|
echo "🔍 从腾讯云 COS 获取上次部署的 hash..."
|
||||||
LAST_HASH=$(curl -sL "$COS_URL" 2>/dev/null || echo "")
|
coscmd download /__build_hash /tmp/last_hash 2>/dev/null || echo ""
|
||||||
|
LAST_HASH=$(cat /tmp/last_hash 2>/dev/null || echo "")
|
||||||
if [ -z "$LAST_HASH" ]; then
|
if [ -z "$LAST_HASH" ]; then
|
||||||
echo "⚠️ 没有找到上次部署的 hash(首次部署)"
|
echo "⚠️ 没有找到上次部署的 hash(首次部署)"
|
||||||
else
|
else
|
||||||
@@ -397,25 +410,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Setup Python
|
|
||||||
if: steps.check.outputs.deployed == 'true'
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: '3.x'
|
|
||||||
|
|
||||||
- name: Install coscmd
|
|
||||||
if: steps.check.outputs.deployed == 'true'
|
|
||||||
run: pip install -U coscmd
|
|
||||||
|
|
||||||
- name: Configure coscmd
|
|
||||||
if: steps.check.outputs.deployed == 'true'
|
|
||||||
env:
|
|
||||||
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
|
|
||||||
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
|
|
||||||
COS_BUCKET: ${{ secrets.COS_BUCKET }}
|
|
||||||
COS_REGION: ${{ secrets.COS_REGION }}
|
|
||||||
run: coscmd config -a $COS_SECRET_ID -s $COS_SECRET_KEY -b $COS_BUCKET -r $COS_REGION
|
|
||||||
|
|
||||||
- name: Download files from COS
|
- name: Download files from COS
|
||||||
if: steps.check.outputs.deployed == 'true'
|
if: steps.check.outputs.deployed == 'true'
|
||||||
id: download-files
|
id: download-files
|
||||||
@@ -488,15 +482,28 @@ jobs:
|
|||||||
id: start-upyun
|
id: start-upyun
|
||||||
run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT
|
run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Get build hash from COS (public URL)
|
- name: Setup Python
|
||||||
id: hash
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install coscmd
|
||||||
|
run: pip install -U coscmd
|
||||||
|
|
||||||
|
- name: Configure coscmd
|
||||||
env:
|
env:
|
||||||
|
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
|
||||||
|
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
|
||||||
COS_BUCKET: ${{ secrets.COS_BUCKET }}
|
COS_BUCKET: ${{ secrets.COS_BUCKET }}
|
||||||
COS_REGION: ${{ secrets.COS_REGION }}
|
COS_REGION: ${{ secrets.COS_REGION }}
|
||||||
|
run: coscmd config -a $COS_SECRET_ID -s $COS_SECRET_KEY -b $COS_BUCKET -r $COS_REGION
|
||||||
|
|
||||||
|
- name: Get build hash from COS
|
||||||
|
id: hash
|
||||||
run: |
|
run: |
|
||||||
COS_URL="https://${COS_BUCKET}.cos.${COS_REGION}.myqcloud.com/__build_hash"
|
|
||||||
echo "🔍 从腾讯云 COS 获取 hash..."
|
echo "🔍 从腾讯云 COS 获取 hash..."
|
||||||
CURRENT_HASH=$(curl -sL "$COS_URL" 2>/dev/null || echo "")
|
coscmd download /__build_hash /tmp/current_hash 2>/dev/null || echo ""
|
||||||
|
CURRENT_HASH=$(cat /tmp/current_hash 2>/dev/null || echo "")
|
||||||
echo "当前 build_hash: $CURRENT_HASH"
|
echo "当前 build_hash: $CURRENT_HASH"
|
||||||
echo "current_hash=${CURRENT_HASH}" >> $GITHUB_OUTPUT
|
echo "current_hash=${CURRENT_HASH}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user