Release #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
permissions: | |
contents: write | |
env: | |
RELEASE_BRANCH: release | |
outputs: | |
branch: ${{ env.RELEASE_BRANCH }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create release branch | |
run: git checkout -B $RELEASE_BRANCH | |
- name: Remove submodule (if exists) | |
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 submodule deinit -f $SUBMODULE_PATH || true | |
git rm -f $SUBMODULE_PATH || true | |
rm -rf .git/modules/$SUBMODULE_PATH || true | |
git commit -m "Remove submodule" | |
else | |
echo "Submodule not found, skipping removal." | |
fi | |
- name: Push release branch | |
run: git push --force --set-upstream origin $RELEASE_BRANCH | |
create-github-release: | |
needs: create-git-branch-release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: Wei18/GitHubSwiftActions/Actions/Release@1.0.7 | |
with: | |
owner: ${{ github.repository_owner }} | |
repo: ${{ github.event.repository.name }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: ${{ needs.create-git-branch-release.outputs.branch }} | |
type: "patch" |