Skip to content

Commit 9bb3089

Browse files
authored
Merge pull request #74 from Wei18/revert-73-remove/gitmodules
Revert "Delete .gitmodules" & add auto release action.
2 parents d244c14 + cc8315f commit 9bb3089

File tree

4 files changed

+91
-5
lines changed

4 files changed

+91
-5
lines changed

.github/dependabot.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ updates:
1111
schedule:
1212
interval: "weekly"
1313

14-
# FIXME: Need other way to update OAS.
15-
# - package-ecosystem: "gitsubmodule"
16-
# directory: "/"
17-
# schedule:
18-
# interval: "weekly"
14+
- package-ecosystem: "gitsubmodule"
15+
directory: "/"
16+
schedule:
17+
interval: "weekly"

.github/workflows/Release.yml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Release
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 1 * *' # 每月的第一天 00:00 UTC
6+
workflow_dispatch: # 允許手動觸發工作流
7+
8+
concurrency:
9+
group: ${{ github.workflow }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
14+
create-git-branch-release:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
branch: ${{ steps.release_branch.outputs.value }}
18+
steps:
19+
- uses: actions/checkout@v3 # Use the latest stable version
20+
21+
- name: Create release branch
22+
env:
23+
RELEASE_BRANCH: release
24+
id: release_branch
25+
run: |
26+
git checkout -B $RELEASE_BRANCH
27+
echo "value=$RELEASE_BRANCH" >> $GITHUB_OUTPUT
28+
29+
- name: Remove submodule (if exists)
30+
env:
31+
SUBMODULE_PATH: Submodule/github/rest-api-description
32+
run: |
33+
if [ -d "$SUBMODULE_PATH" ]; then
34+
git submodule deinit -f $SUBMODULE_PATH || true
35+
git rm -f $SUBMODULE_PATH || true
36+
rm -rf .git/modules/$SUBMODULE_PATH || true
37+
git commit -m "Remove submodule"
38+
git push
39+
else
40+
echo "Submodule not found, skipping removal."
41+
fi
42+
43+
create-github-release:
44+
needs: create-git-branch-release
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v3
49+
50+
- name: Get latest version
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
run: |
54+
LATEST_VERSION=$(gh release view --repo ${{ github.repository }} --json tagName --jq .tagName)
55+
echo "Latest release version: $LATEST_VERSION"
56+
echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
57+
58+
- name: Bump patch version
59+
run: |
60+
# Extract version numbers
61+
VERSION=${LATEST_VERSION#v}
62+
MAJOR=$(echo $VERSION | cut -d. -f1)
63+
MINOR=$(echo $VERSION | cut -d. -f2)
64+
PATCH=$(echo $VERSION | cut -d. -f3)
65+
66+
# Bump the patch number
67+
PATCH=$((PATCH+1))
68+
69+
# Form new version
70+
NEW_VERSION="v$MAJOR.$MINOR.$PATCH"
71+
echo "New version: $NEW_VERSION"
72+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
73+
74+
- name: Create new GitHub release
75+
env:
76+
GIT_REF: ${{ needs.create-git-branch-release.outputs.branch }}
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
run: |
79+
gh release create $NEW_VERSION \
80+
--repo ${{ github.repository }} \
81+
--generate-notes \
82+
--target "$GIT_REF"

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "Submodule/github/rest-api-description"]
2+
path = Submodule/github/rest-api-description
3+
url = https://github.com/github/rest-api-description.git
4+
shallow = true

Submodule/github/rest-api-description

Submodule rest-api-description added at 38baa7a

0 commit comments

Comments
 (0)