|
4 | 4 | workflow_dispatch:
|
5 | 5 | inputs:
|
6 | 6 | version:
|
7 |
| - description: 'The version you want to release.' |
| 7 | + description: "Select the version increment" |
8 | 8 | required: true
|
| 9 | + type: choice |
| 10 | + options: |
| 11 | + - major |
| 12 | + - minor |
| 13 | + - patch |
| 14 | + - premajor |
| 15 | + - preminor |
| 16 | + - prepatch |
| 17 | + - prerelease |
9 | 18 |
|
10 | 19 | jobs:
|
11 | 20 | prepare-release:
|
12 | 21 | name: Prepare release
|
13 | 22 | runs-on: ubuntu-latest
|
14 | 23 | steps:
|
15 |
| - - uses: actions/checkout@v2 |
| 24 | + - name: Checkout branch |
| 25 | + uses: actions/checkout@v4 |
16 | 26 | with:
|
17 | 27 | fetch-depth: 0
|
18 |
| - - uses: actions/setup-node@v3 |
| 28 | + |
| 29 | + - name: Setup Node |
| 30 | + uses: actions/setup-node@v4 |
19 | 31 | with:
|
20 |
| - node-version-file: '.node-version' |
| 32 | + node-version-file: ".node-version" |
21 | 33 |
|
22 |
| - - name: Create release branch |
23 |
| - run: git checkout -b release/${{ github.event.inputs.version }} |
| 34 | + - name: Setup Yarn |
| 35 | + uses: volta-cli/action@v4 |
24 | 36 |
|
25 |
| - - name: Initialize mandatory git config |
26 |
| - uses: fregante/setup-git-user@v1 |
| 37 | + - name: Setup env |
| 38 | + run: echo "FONTAWESOME_NPM_AUTH_TOKEN=${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}" > .env |
27 | 39 |
|
28 | 40 | - name: Bump version in package.json
|
29 |
| - run: yarn version --new-version ${{ github.event.inputs.version }} --no-git-tag-version |
| 41 | + run: yarn version ${{ github.event.inputs.version }} |
| 42 | + |
| 43 | + - name: Extract version from package.json |
| 44 | + id: extract_version |
| 45 | + run: | |
| 46 | + version=$(grep '"version"' package.json | sed -E 's/.*"version": "([^"]+)".*/\1/') |
| 47 | + echo "Extracted version: $version" |
| 48 | + echo "::set-output name=version::$version" |
| 49 | +
|
| 50 | + - name: Create release branch |
| 51 | + run: git checkout -b release/v${{ steps.extract_version.outputs.version }} |
| 52 | + |
| 53 | + - name: Initialize mandatory git config |
| 54 | + uses: fregante/setup-git-user@v2 |
30 | 55 |
|
31 | 56 | - name: Commit manifest files
|
32 | 57 | id: make-commit
|
33 | 58 | run: |
|
34 | 59 | git add package.json
|
35 |
| - git commit --message "Prepare release ${{ github.event.inputs.version }}" |
| 60 | + git commit --message "Prepare release v${{ steps.extract_version.outputs.version }}" |
36 | 61 |
|
37 | 62 | echo "::set-output name=commit::$(git rev-parse HEAD)"
|
38 | 63 |
|
39 | 64 | - name: Publish release branch
|
40 |
| - run: git push origin release/${{ github.event.inputs.version }} |
| 65 | + run: git push origin release/v${{ steps.extract_version.outputs.version }} |
41 | 66 |
|
42 | 67 | - name: Merge release into main branch
|
43 | 68 | uses: thomaseizinger/[email protected]
|
44 | 69 | env:
|
45 | 70 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
46 | 71 | with:
|
47 |
| - head: release/${{ github.event.inputs.version }} |
| 72 | + head: release/v${{ steps.extract_version.outputs.version }} |
48 | 73 | base: main
|
49 |
| - title: Merge release/${{ github.event.inputs.version }} into main branch |
| 74 | + title: "Merge release/v${{ steps.extract_version.outputs.version }} into main branch" |
50 | 75 |
|
51 | 76 | - name: Merge release into develop branch
|
52 | 77 | uses: thomaseizinger/[email protected]
|
53 | 78 | env:
|
54 | 79 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
55 | 80 | with:
|
56 |
| - head: release/${{ github.event.inputs.version }} |
| 81 | + head: release/v${{ steps.extract_version.outputs.version }} |
57 | 82 | base: develop
|
58 |
| - title: Merge release/${{ github.event.inputs.version }} into develop branch |
59 |
| - |
| 83 | + title: "Merge release/v${{ steps.extract_version.outputs.version }} into develop branch" |
0 commit comments