1
- name : Prepare Release
2
- # This workflow is manually dispatched. It:
3
- # - bumps the version as specified in the input
4
- # - prepares build artifacts
5
- # - creates a release branch
6
- # - commits the changes
7
- # - creates a pull request to the main branch
8
- # - TODO: consider skipping the PR, push to main, and create a release automatically
1
+ name : Newfold Prepare Release
9
2
10
3
on :
11
4
workflow_dispatch :
21
14
required : true
22
15
23
16
jobs :
24
- prep-release :
25
- name : Prepare Release
17
+
18
+ # This job is used to extract the branch name from the pull request or branch.
19
+ setup :
20
+ name : Setup
26
21
runs-on : ubuntu-latest
27
- permissions :
28
- # Give the default token permission to commit, push the changed files, and open a pull request.
29
- contents : write
30
- pull-requests : write
22
+ outputs :
23
+ branch : ${{ steps.extract_branch.outputs.branch }}
31
24
steps :
32
- - name : Checkout
33
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34
-
35
- - name : Setup PHP
36
- uses : shivammathur/setup-php@cf4cade2721270509d5b1c766ab3549210a39a2a # v2.33.0
37
- with :
38
- php-version : ' 8.1'
39
- coverage : none
40
- tools : composer, cs2pr
41
-
42
- - name : Setup Node.js
43
- uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
44
- with :
45
- node-version : 20.x
46
- cache : ' npm'
47
-
48
- - name : Get Composer cache directory
49
- id : composer-cache
50
- run : echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
51
-
52
- - name : Cache Composer vendor directory
53
- uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
54
- with :
55
- path : ${{ steps.composer-cache.outputs.dir }}
56
- key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
57
- restore-keys : |
58
- ${{ runner.os }}-composer-
25
+ - name : Extract branch name
26
+ shell : bash
27
+ run : echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
28
+ id : extract_branch
59
29
60
- - name : Show versions
61
- run : |
62
- php --version
63
- composer --version
64
- node --version
65
- npm --version
66
-
67
- - name : Validate composer.json and composer.lock
68
- run : composer validate
69
-
70
- - name : Install Packages
71
- run : npm install
72
-
73
- - name : Run Update Version Script
74
- id : version_bump
75
- run : |
76
- echo "Running version bump script..."
77
- OUTPUT=$(node ./.github/scripts/set-version-bump.js ${{ inputs.level }})
78
- echo ""
79
- echo "====== Script Output ======"
80
- echo "$OUTPUT"
81
- echo "==========================="
82
- echo ""
83
- echo "new_version=$(echo "$OUTPUT" | jq -r '.newVersion')" >> $GITHUB_OUTPUT
84
- echo "old_version=$(echo "$OUTPUT" | jq -r '.oldVersion')" >> $GITHUB_OUTPUT
85
- echo "message=$(echo "$OUTPUT" | jq -r '.message')" >> $GITHUB_OUTPUT
86
-
87
- - name : Run Build and Update Language Files
88
- run : npm run post-set-version
89
-
90
- - name : Create Release Pull Request
91
- uses : peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
92
- with :
93
- token : ${{ github.token }}
94
- base : trunk
95
- branch : release/${{ steps.version_bump.outputs.new_version }}
96
- title : " Automated ${{ inputs.level }} Release ${{ steps.version_bump.outputs.new_version }} PR"
97
- body : " This PR was created automatically by a GitHub Action."
98
- commit-message : " 🤖 prep release - ${{ steps.version_bump.outputs.message }}"
30
+ # This job runs the newfold module-prep-release workflow for this module.
31
+ prep-release :
32
+ name : Prepare Release
33
+ needs : setup
34
+ uses : newfold-labs/workflows/.github/workflows/reusable-module-prep-release.yml@main
35
+ with :
36
+ module-repo : ${{ github.repository }}
37
+ module-branch : ${{ needs.setup.outputs.branch }}
38
+ level : ${{ inputs.level }}
39
+ json-file : ' package.json'
40
+ php-file : ' bootstrap.php'
41
+ secrets : inherit
0 commit comments