|
4 | 4 | workflow_dispatch: |
5 | 5 | inputs: |
6 | 6 | versionType: |
7 | | - description: 'Version type (major, minor, patch)' |
| 7 | + description: 'Version type (major, minor, patch, or auto)' |
8 | 8 | required: true |
9 | | - default: 'patch' |
10 | | - branches: |
11 | | - - master |
| 9 | + default: 'auto' |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - auto |
| 13 | + - patch |
| 14 | + - minor |
| 15 | + - major |
12 | 16 |
|
13 | 17 | jobs: |
14 | 18 | npm-release: |
15 | 19 | if: github.ref == 'refs/heads/master' |
16 | 20 | runs-on: ubuntu-latest |
17 | 21 | steps: |
18 | 22 | - name: Checkout code |
19 | | - uses: actions/checkout@v2 |
| 23 | + uses: actions/checkout@v4 |
20 | 24 | with: |
21 | | - fetch-depth: 0 # fetch all history so that we can determine the version bump |
22 | | - |
| 25 | + fetch-depth: 0 |
| 26 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + |
23 | 28 | - name: Configure Git |
24 | 29 | run: | |
25 | | - git config --global user.name "${{ secrets.GIT_USER_NAME }}" |
26 | | - git config --global user.email "${{ secrets.GIT_USER_EMAIL }}" |
| 30 | + git config --global user.name "github-actions[bot]" |
| 31 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
27 | 32 |
|
28 | 33 | - name: Setup Node.js |
29 | | - uses: actions/setup-node@v2 |
| 34 | + uses: actions/setup-node@v4 |
30 | 35 | with: |
31 | | - node-version: '16' |
| 36 | + node-version: '18' |
32 | 37 | registry-url: 'https://registry.npmjs.org/' |
| 38 | + cache: 'npm' |
33 | 39 |
|
34 | 40 | - name: Install dependencies |
35 | | - run: npm install |
| 41 | + run: npm ci |
36 | 42 |
|
37 | | - # - name: Run Tests |
38 | | - # run: | |
39 | | - # npx playwright install --with-deps chromium |
40 | | - # npm test |
| 43 | + - name: Run tests |
| 44 | + run: | |
| 45 | + npx playwright install --with-deps chromium |
| 46 | + npm test |
41 | 47 |
|
42 | 48 | - name: Build the package |
43 | 49 | run: npm run build |
44 | | - |
45 | | - - name: Bump version |
46 | | - run: npm version ${{ github.event.inputs.versionType }} -m "Upgrade to %s" |
47 | | - |
| 50 | + |
| 51 | + - name: Release (auto-determine version) |
| 52 | + if: github.event.inputs.versionType == 'auto' |
| 53 | + run: npm run release |
| 54 | + |
| 55 | + - name: Release (specific version) |
| 56 | + if: github.event.inputs.versionType != 'auto' |
| 57 | + run: npm run release:${{ github.event.inputs.versionType }} |
| 58 | + |
48 | 59 | - name: Publish to npm |
49 | | - run: npm publish |
| 60 | + run: npm run publish:npm |
50 | 61 | env: |
51 | 62 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
52 | 63 |
|
53 | 64 | - name: Push changes and tags |
54 | | - run: | |
55 | | - git config user.name "${{ secrets.GIT_USER_NAME }}" |
56 | | - git config user.email "${{ secrets.GIT_USER_EMAIL }}" |
57 | | - git push |
58 | | - git push --tags |
| 65 | + run: git push --follow-tags origin master |
| 66 | + |
| 67 | + - name: Get version for GitHub release |
| 68 | + id: version |
| 69 | + run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT |
| 70 | + |
| 71 | + - name: Create GitHub Release |
| 72 | + uses: actions/create-release@v1 |
| 73 | + env: |
| 74 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + with: |
| 76 | + tag_name: v${{ steps.version.outputs.version }} |
| 77 | + release_name: Release v${{ steps.version.outputs.version }} |
| 78 | + body: | |
| 79 | + ## What's Changed |
| 80 | +
|
| 81 | + See [CHANGELOG.md](https://github.com/abhinaba-ghosh/axe-playwright/blob/v${{ steps.version.outputs.version }}/CHANGELOG.md) for detailed changes. |
| 82 | +
|
| 83 | + **Full Changelog**: https://github.com/abhinaba-ghosh/axe-playwright/blob/v${{ steps.version.outputs.version }}/CHANGELOG.md |
| 84 | + draft: false |
| 85 | + prerelease: false |
0 commit comments