Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Revert "Delete .gitmodules" & add auto release action. #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ updates:
schedule:
interval: "weekly"

# FIXME: Need other way to update OAS.
# - package-ecosystem: "gitsubmodule"
# directory: "/"
# schedule:
# interval: "weekly"
- package-ecosystem: "gitsubmodule"
directory: "/"
schedule:
interval: "weekly"
82 changes: 82 additions & 0 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Release

on:
schedule:
- cron: '0 0 1 * *' # 每月的第一天 00:00 UTC
workflow_dispatch: # 允許手動觸發工作流

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:

create-git-branch-release:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.release_branch.outputs.value }}
steps:
- uses: actions/checkout@v3 # Use the latest stable version

- name: Create release branch
env:
RELEASE_BRANCH: release
id: release_branch
run: |
git checkout -B $RELEASE_BRANCH
echo "value=$RELEASE_BRANCH" >> $GITHUB_OUTPUT

- name: Remove submodule (if exists)
env:
SUBMODULE_PATH: Submodule/github/rest-api-description
run: |
if [ -d "$SUBMODULE_PATH" ]; then
git submodule deinit -f $SUBMODULE_PATH || true
git rm -f $SUBMODULE_PATH || true
rm -rf .git/modules/$SUBMODULE_PATH || true
git commit -m "Remove submodule"
git push
else
echo "Submodule not found, skipping removal."
fi

create-github-release:
needs: create-git-branch-release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Get latest version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LATEST_VERSION=$(gh release view --repo ${{ github.repository }} --json tagName --jq .tagName)
echo "Latest release version: $LATEST_VERSION"
echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV

- name: Bump patch version
run: |
# Extract version numbers
VERSION=${LATEST_VERSION#v}
MAJOR=$(echo $VERSION | cut -d. -f1)
MINOR=$(echo $VERSION | cut -d. -f2)
PATCH=$(echo $VERSION | cut -d. -f3)

# Bump the patch number
PATCH=$((PATCH+1))

# Form new version
NEW_VERSION="v$MAJOR.$MINOR.$PATCH"
echo "New version: $NEW_VERSION"
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV

- name: Create new GitHub release
env:
GIT_REF: ${{ needs.create-git-branch-release.outputs.branch }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create $NEW_VERSION \
--repo ${{ github.repository }} \
--generate-notes \
--target "$GIT_REF"
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "Submodule/github/rest-api-description"]
path = Submodule/github/rest-api-description
url = https://github.com/github/rest-api-description.git
shallow = true
1 change: 1 addition & 0 deletions Submodule/github/rest-api-description
Submodule rest-api-description added at 38baa7