|
| 1 | +name: Release CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'release/[0-9]+.[0-9]+.[0-9]+' |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + runs-on: macOS-latest |
| 11 | + permissions: |
| 12 | + contents: write |
| 13 | + pull-requests: write |
| 14 | + |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + node-version: [18.x] |
| 18 | + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v3 |
| 22 | + - run: | |
| 23 | + git config user.name ${{ github.actor }} |
| 24 | + git config user.email ${{ github.actor }}@users.noreply.github.com |
| 25 | +
|
| 26 | + - name: Use Node.js ${{ matrix.node-version }} |
| 27 | + uses: actions/setup-node@v3 |
| 28 | + with: |
| 29 | + node-version: ${{ matrix.node-version }} |
| 30 | + cache: 'npm' |
| 31 | + cache-dependency-path: './common/config/rush/pnpm-lock.yaml' |
| 32 | + |
| 33 | + # Install rush |
| 34 | + - name: Install rush |
| 35 | + run: node common/scripts/install-run-rush.js install --bypass-policy |
| 36 | + |
| 37 | + - name: Parse semver version from branch name |
| 38 | + id: semver_parser |
| 39 | + uses: xile611/read-package-version-action@main |
| 40 | + with: |
| 41 | + path: packages/vmind |
| 42 | + semver_string: ${{ github.ref_name }} |
| 43 | + semver_pattern: '^release/(.*)$' # ^v?(.*)$ by default |
| 44 | + |
| 45 | + - name: update nextBump of version policies |
| 46 | + uses: xile611/set-next-bump-of-rush@main |
| 47 | + with: |
| 48 | + release_version: ${{ steps.semver_parser.outputs.full }} |
| 49 | + write_next_bump: true |
| 50 | + |
| 51 | + - name: Update version |
| 52 | + run: node common/scripts/install-run-rush.js version --bump |
| 53 | + |
| 54 | + - name: Build packages |
| 55 | + env: |
| 56 | + NODE_OPTIONS: '--max_old_space_size=4096' |
| 57 | + run: node common/scripts/install-run-rush.js build --only tag:package |
| 58 | + |
| 59 | + - name: Publish to npm |
| 60 | + env: |
| 61 | + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
| 62 | + NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
| 63 | + run: node common/scripts/install-run-rush.js publish --publish --include-all --tag latest |
| 64 | + |
| 65 | + - name: Update shrinkwrap |
| 66 | + run: node common/scripts/install-run-rush.js update |
| 67 | + |
| 68 | + - name: Get npm version |
| 69 | + id: package-version |
| 70 | + uses: xile611/read-package-version-action@main |
| 71 | + with: |
| 72 | + path: packages/vmind |
| 73 | + |
| 74 | + - name: Commit & Push changes |
| 75 | + run: | |
| 76 | + git add . |
| 77 | + git commit -m 'build: prelease version ${{ steps.package-version.outputs.current_version }}' -n |
| 78 | + git push origin ${{ github.ref_name }} |
| 79 | +
|
| 80 | + - name: Collect changelog of rush |
| 81 | + uses: xile611/collect-rush-changlog@main |
| 82 | + id: changelog |
| 83 | + with: |
| 84 | + version: ${{ steps.package-version.outputs.current_version }} |
| 85 | + |
| 86 | + - name: Create Release for Tag |
| 87 | + id: release_tag |
| 88 | + |
| 89 | + env: |
| 90 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 91 | + with: |
| 92 | + tag: v${{ steps.package-version.outputs.current_version }} |
| 93 | + commit: main |
| 94 | + prerelease: false |
| 95 | + body: | |
| 96 | + ${{ steps.changelog.outputs.markdown }} |
| 97 | + draft: true # |
| 98 | + |
| 99 | + - name: Create Pull Request |
| 100 | + uses: dustinirving/[email protected] |
| 101 | + with: |
| 102 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 103 | + title: '[Auto release] release ${{ steps.package-version.outputs.current_version }}' |
| 104 | + base: main |
| 105 | + head: ${{ github.ref_name }} |
| 106 | + labels: release # default labels, the action will throw error if not specified |
| 107 | + reviewers: kkxxkk2019 # default reviewers, the action will throw error if not specified |
| 108 | + body: | |
| 109 | + ${{ steps.changelog.outputs.markdown }} |
0 commit comments