-
Notifications
You must be signed in to change notification settings - Fork 3
85 lines (74 loc) · 2.34 KB
/
Release.yml
File metadata and controls
85 lines (74 loc) · 2.34 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Release
on:
schedule:
- cron: '0 0 1 * *' # 每月的第一天 00:00 UTC
workflow_dispatch: # 允許手動觸發工作流
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
env:
RELEASE_BRANCH: release
jobs:
create-git-branch-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Remove submodule to improve Swift Package experience
env:
SUBMODULE_PATH: Submodule/github/rest-api-description
run: |
if [ -d "$SUBMODULE_PATH" ]; then
#
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
#
git checkout -B $RELEASE_BRANCH
#
git rm $SUBMODULE_PATH
git commit -m "Remove submodule to improve Swift Package experience"
git push --set-upstream origin $RELEASE_BRANCH
else
echo "::error ::Submodule not found, skipping removal."
exit 1
fi
create-github-release:
needs: create-git-branch-release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: Wei18/GitHubSwiftActions/Actions/Release@1.0.9
with:
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
token: ${{ github.token }}
ref: ${{ env.RELEASE_BRANCH }}
type: "patch"
create-pull-request:
needs: create-github-release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ env.RELEASE_BRANCH }}
fetch-depth: 2
- name: Revert previous commit
run: |
#
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
#
git revert --no-edit HEAD
git push
- name: Create pull request
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
PR_URL="$(gh pr create --head $RELEASE_BRANCH --title 'Bump patch version' --body 'Automated monthly release merge')"
gh pr merge --auto --merge "$PR_URL"
gh pr merge --merge --admin "$PR_URL"