File tree Expand file tree Collapse file tree 3 files changed +138
-0
lines changed Expand file tree Collapse file tree 3 files changed +138
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : " (Build): Plugin"
2
+
3
+ on :
4
+ workflow_call :
5
+ inputs :
6
+ ref :
7
+ required : false
8
+ type : string
9
+ default : ${{ inputs.ref }}
10
+ outputs :
11
+ artifact_name :
12
+ value : ${{ jobs.build.outputs.artifact_name }}
13
+ artifact_url :
14
+ value : ${{ jobs.build.outputs.artifact_url }}
15
+ jobs :
16
+ build :
17
+ runs-on : ubuntu-latest
18
+ outputs :
19
+ artifact_name : ${{ steps.build.outputs.name }}
20
+ artifact_url : ${{ steps.artifacts.outputs.artifact-url }}
21
+ steps :
22
+ - uses : actions/checkout@v4
23
+ with :
24
+ ref : ${{ inputs.ref }}
25
+
26
+ - name : Set up PHP
27
+ uses : shivammathur/setup-php@v2
28
+ with :
29
+ php-version : ' 8.1'
30
+
31
+ - name : Set up Node.js
32
+ uses : actions/setup-node@v4
33
+ with :
34
+ node-version-file : .node-version
35
+
36
+ - name : Install & Build
37
+ id : build
38
+ run : |
39
+ npm install && npm run bundle
40
+ echo "name=$(jq -r .name package.json)" >> $GITHUB_OUTPUT
41
+
42
+ - name : Upload
43
+ id : artifacts
44
+ uses : actions/upload-artifact@v4
45
+ with :
46
+ name : ${{ steps.build.outputs.name }}
47
+ path : ./bundle
Original file line number Diff line number Diff line change
1
+ name : " (Pull Request): Build"
2
+
3
+ on :
4
+ pull_request :
5
+ types : [labeled]
6
+
7
+ jobs :
8
+ comment :
9
+ if : contains(github.event.pull_request.labels.*.name, 'build')
10
+ runs-on : ubuntu-latest
11
+ outputs :
12
+ comment_id : ${{ steps.comment.outputs.comment-id }}
13
+ steps :
14
+ - name : Comment
15
+ id : comment
16
+ uses : peter-evans/create-or-update-comment@v4
17
+ with :
18
+ issue-number : ${{ github.event.pull_request.number }}
19
+ body : |
20
+ 👌 Build started.. a link to the built zip file will appear here soon..
21
+
22
+ install :
23
+ needs : comment
24
+ uses : ./.github/workflows/build.yml
25
+ with :
26
+ ref : ${{ github.head_ref }}
27
+
28
+ publish :
29
+ needs : ['comment', 'install']
30
+ runs-on : ubuntu-latest
31
+ steps :
32
+ - name : Publish comment
33
+ if : ${{ needs.install.outputs.artifact_name || needs.install.outputs.artifact_url }}
34
+ uses : peter-evans/create-or-update-comment@v4
35
+ with :
36
+ edit-mode : replace
37
+ comment-id : ${{ needs.comment.outputs.comment_id }}
38
+ body : |
39
+ ### Download and install
40
+ 📦 [${{ needs.install.outputs.artifact_name }}.zip](${{ needs.install.outputs.artifact_url }})
Original file line number Diff line number Diff line change
1
+ name : " (Release): Build"
2
+
3
+ on :
4
+ release :
5
+ types : [created]
6
+
7
+ jobs :
8
+ install :
9
+ uses : ./.github/workflows/build.yml
10
+ with :
11
+ ref : ${{ github.event.release.tag_name }}
12
+
13
+ upload :
14
+ needs : install
15
+ runs-on : ubuntu-latest
16
+ steps :
17
+ - name : Get artifact url
18
+ id : artifact
19
+ run : |
20
+ url="${{ needs.install.outputs.artifact_url }}"
21
+ id="${url##*/}"
22
+ echo "id=$id" >> $GITHUB_OUTPUT
23
+
24
+ - name : Download built zip
25
+ id : download
26
+ uses : actions/download-artifact@v4
27
+ with :
28
+ artifact-ids : ${{ steps.artifact.outputs.id }}
29
+ path : ./dist
30
+
31
+ - name : Get artifact url
32
+ id : zip
33
+ run : |
34
+ zip_name="${{ needs.install.outputs.artifact_name }}.zip"
35
+
36
+ cd ./dist/${{ needs.install.outputs.artifact_name }}
37
+ zip -r "../$zip_name" .
38
+ cd ..
39
+
40
+ echo "path=$(pwd)/$zip_name" >> $GITHUB_OUTPUT
41
+
42
+ - name : Upload release asset
43
+ uses : softprops/action-gh-release@v2
44
+ with :
45
+ files : ${{ steps.zip.outputs.path }}
46
+
47
+ # deploy:
48
+ # needs: upload
49
+ # uses: ./.github/workflows/svn_push.yml
50
+ # with:
51
+ # ref: ${{ github.event.release.tag_name }}
You can’t perform that action at this time.
0 commit comments