-
Notifications
You must be signed in to change notification settings - Fork 4
67 lines (55 loc) · 2.12 KB
/
DeployAutoArchiving.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
concurrency:
group: deploy-group
name: Deploy auto archiving script
run-name: Deploy auto archiving script
on:
repository_dispatch:
types: [deploy]
workflow_dispatch:
inputs:
commit_message:
description: 手动触发部署流水线的原因:
required: true
default: "deploy auto archiving script manually"
permissions:
contents: write
env:
AUTO_ARCHIVING_SCRIPT_ARCHIVE_URL : "https://github.com/revengenowstudio/rn_issues_auto_archiving/archive/refs/heads/main.zip"
AUTO_ARCHIVING_YML_PATH: "./.github/workflows/AutoArchiving.yml"
COMMIT_MESSAGE: ${{ github.event.inputs.commit_message }}${{ github.event.client_payload.commit_message }}
jobs:
deploy:
name: Deploy auto archiving script
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
sparse-checkout: |
.github/
- name: Pull auto archiving script
# github action 的GITHUB_TOKEN是不提供workflows权限的,所以没法使用GITHUB_TOKEN自动部署流水线yml
run: |
wget $AUTO_ARCHIVING_SCRIPT_ARCHIVE_URL
unzip -q main.zip
cp -rfv ./rn_issues_auto_archiving-main/config ./
cp -rfv ./rn_issues_auto_archiving-main/rn_issue_auto_archiving ./
content=$(<"$AUTO_ARCHIVING_YML_PATH")
updated_content=$(echo "$content" | sed 's/TARGET_BRANCH:[[:space:]]*main/TARGET_BRANCH: master/g')
echo "$updated_content" >"$AUTO_ARCHIVING_YML_PATH"
rm -rf ./rn_issues_auto_archiving-main
rm -f ./main.zip
- name: Push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add ./config
git add ./rn_issues_auto_archiving
diff=$(git diff --cached)
if [[ -z $diff ]]; then
echo "no file changes"
else
echo "some file changes , pushing changes"
git commit -m "${{ env.COMMIT_MESSAGE }}"
git push origin master
fi