Release #27
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 | |
| env: | |
| RELEASE_BRANCH: release | |
| jobs: | |
| create-git-branch-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - 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@v5 | |
| with: | |
| ref: ${{ env.RELEASE_BRANCH }} | |
| - 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" |