Update deploy.yml
This commit is contained in:
1 parent
0e9ccbd6c1
commit
52a0a2de8b
1 file changed
+23
-57
@@ -112,6 +112,7 @@ jobs:
|
||||
contents: write
|
||||
outputs:
|
||||
build_hash: ${{ steps.hash.outputs.build_hash }}
|
||||
last_hash: ${{ steps.last-hash.outputs.last_hash }}
|
||||
duration: ${{ steps.end-build.outputs.duration }}
|
||||
file_count: ${{ steps.stats.outputs.file_count }}
|
||||
total_size: ${{ steps.stats.outputs.total_size }}
|
||||
@@ -358,40 +359,11 @@ jobs:
|
||||
id: start-edgeone
|
||||
run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install coscmd
|
||||
run: pip install -U coscmd
|
||||
|
||||
- name: Configure coscmd
|
||||
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: Get build hash from COS
|
||||
id: hash
|
||||
run: |
|
||||
echo "🔍 从腾讯云 COS 获取上次部署的 hash..."
|
||||
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
|
||||
echo "⚠️ 没有找到上次部署的 hash(首次部署)"
|
||||
else
|
||||
echo "上次部署 hash: $LAST_HASH"
|
||||
fi
|
||||
echo "last_hash=${LAST_HASH}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Check if deployment is needed
|
||||
id: check
|
||||
run: |
|
||||
CURRENT_HASH="${{ needs.build.outputs.build_hash }}"
|
||||
LAST_HASH="${{ steps.hash.outputs.last_hash }}"
|
||||
LAST_HASH="${{ needs.build.outputs.last_hash }}"
|
||||
|
||||
echo "当前 build_hash: $CURRENT_HASH"
|
||||
echo "上次部署 hash: $LAST_HASH"
|
||||
@@ -410,6 +382,25 @@ jobs:
|
||||
with:
|
||||
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
|
||||
if: steps.check.outputs.deployed == 'true'
|
||||
id: download-files
|
||||
@@ -482,36 +473,11 @@ jobs:
|
||||
id: start-upyun
|
||||
run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install coscmd
|
||||
run: pip install -U coscmd
|
||||
|
||||
- name: Configure coscmd
|
||||
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: Get build hash from COS
|
||||
id: hash
|
||||
run: |
|
||||
echo "🔍 从腾讯云 COS 获取 hash..."
|
||||
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 "current_hash=${CURRENT_HASH}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Check if deployment is needed
|
||||
id: check
|
||||
run: |
|
||||
CURRENT_HASH="${{ steps.hash.outputs.current_hash }}"
|
||||
LAST_HASH="${{ needs.build.outputs.build_hash }}"
|
||||
CURRENT_HASH="${{ needs.build.outputs.build_hash }}"
|
||||
LAST_HASH="${{ needs.build.outputs.last_hash }}"
|
||||
|
||||
echo "当前 build_hash: $CURRENT_HASH"
|
||||
echo "上次部署 hash: $LAST_HASH"
|
||||
|
||||
Reference in new issue
Block a user