|
| 1 | +# Create and push the commit and tag created from npm version <version> |
| 2 | +# |
| 3 | +# From the Actions page on GitHub, users (with write permissions) can select |
| 4 | +# the desired release <version> and this action will handle running npm version |
| 5 | +# and pushing the tag to the repository. |
| 6 | +# |
| 7 | +# Due to the VERSION_TOKEN, the tag push will trigger release.yml, which handles |
| 8 | +# releasing to npm and GitHub releases. |
| 9 | +# |
| 10 | +# With pre* versions (prerelease, prepatch, etc.), the tag will be created with |
| 11 | +# --preid beta. Currently, they are released normally, to --tag latest on npm. |
| 12 | + |
1 | 13 | name: Push new version |
2 | 14 |
|
3 | 15 | on: |
|
16 | 28 | - prepatch |
17 | 29 | - preminor |
18 | 30 | - premajor |
19 | | - # Uncomment the following for text input preId |
20 | | - # preId: |
21 | | - # description: 'Prerelease identifier (required with pre*)' |
22 | | - # required: false |
23 | | - # type: string |
24 | | - # Uncomment the following for selection preId |
25 | | - # preId: |
26 | | - # description: 'Prerelease identifier (used with pre*)' |
27 | | - # required: true |
28 | | - # default: 'beta' |
29 | | - # type: choice |
30 | | - # options: |
31 | | - # - alpha |
32 | | - # - beta |
33 | 31 |
|
34 | 32 | jobs: |
35 | | - # Uncomment the following step if using text input preId |
36 | | - # validate: |
37 | | - # name: Validate workflow inputs |
38 | | - # runs-on: ubuntu-latest |
39 | | - |
40 | | - # steps: |
41 | | - # - name: Invalid prerelease identifier |
42 | | - # if: ${{ startsWith(github.event.inputs.version, 'pre') && !github.event.inputs.preId }} |
43 | | - # run: | |
44 | | - # echo "Error: 'preId' input is required with 'pre-*' version." |
45 | | - # exit 1 |
46 | | - |
47 | 33 | version: |
48 | 34 | name: Push ${{ inputs.version }} tag |
49 | 35 | runs-on: ubuntu-latest |
50 | 36 |
|
51 | | - # Uncomment the following line if using the validate step above |
52 | | - # needs: [validate] |
53 | | - |
54 | 37 | steps: |
55 | 38 | - name: Checkout branch |
56 | 39 | uses: actions/checkout@v4 |
|
67 | 50 | run: | |
68 | 51 | git config --global user.name "${{ github.actor }}" |
69 | 52 | git config --global user.email "${{ github.actor }}@users.noreply.github.com" |
70 | | - - name: NPM version |
71 | | - # Uncomment the following line if using preId input |
72 | | - # run: echo "version=$(npm version ${{ inputs.version }}${{ startsWith(inputs.version, 'pre') && format(' --preid {0}', inputs.preId) || '' }})" >> "$GITHUB_ENV" |
73 | | - # Uncomment the following line for hardcoded 'beta' preId |
74 | | - run: echo "version=$(npm version ${{ inputs.version }})${{ startsWith(inputs.version, 'pre') && '--preid beta' || ''}}" >> "$GITHUB_ENV" |
75 | | - - name: Git push |
| 53 | + - name: npm version ${{ inputs.version }} |
| 54 | + run: echo "version=$(npm version ${{ inputs.version }}${{ startsWith(inputs.version, 'pre') && '--preid beta' || '' }})" >> "$GITHUB_ENV" |
| 55 | + - name: git push |
76 | 56 | run: git push && git push origin ${{ env.version }} |
0 commit comments