@@ -19,23 +19,23 @@ jobs:
19
19
with :
20
20
run-id : ${{ github.event.workflow_run.id }}
21
21
github-token : ${{ github.token }}
22
+ merge-multiple : true
22
23
name : page-build
23
24
path : public
24
25
25
26
- name : change URLs for large files
26
27
shell : bash
27
- run : |
28
- sed -i 's|search/search_index.json|https://storage.googleapis.com/cp-algorithms/search_index.json|g' public/assets/javascripts/*.js
28
+ run : sed -i 's|search/search_index.json|https://storage.googleapis.com/cp-algorithms/search_index.json|g' public/assets/javascripts/*.js
29
29
30
- - id : ' auth'
31
- uses : ' google-github-actions/auth@v2.1.6'
30
+ - id : auth
31
+ uses : google-github-actions/auth@v2.1.6
32
32
with :
33
33
credentials_json : ' ${{ secrets.GCP_CREDENTIALS }}'
34
34
35
- - uses : ' google-github-actions/upload-cloud-storage@v1'
35
+ - uses : google-github-actions/upload-cloud-storage@v1
36
36
with :
37
- path : ' public/search/search_index.json'
38
- destination : ' cp-algorithms'
37
+ path : public/search/search_index.json
38
+ destination : cp-algorithms
39
39
40
40
- uses : FirebaseExtended/action-hosting-deploy@v0
41
41
id : firebase-deploy
@@ -60,33 +60,30 @@ jobs:
60
60
name : page-build
61
61
path : public
62
62
63
- - name : Configure git
63
+ - name : Get PR number from artifact
64
+ id : get-pr-number
65
+ run : echo "pr_number=$(ls public)" >> $GITHUB_OUTPUT
66
+
67
+ - name : Configure git
64
68
run : |
65
69
git config --global user.name "github-actions[bot]"
66
70
git config --global user.email "github-actions[bot]@users.noreply.github.com"
67
-
68
- - name : Get PR information
69
- uses : potiuk/get-workflow-origin@v1_6
70
- id : source-run-info
71
- with :
72
- token : ${{ github.token }}
73
- sourceRunId : ${{ github.event.workflow_run.id }}
74
-
71
+
75
72
- name : Deploy to gh-pages
76
73
uses : peaceiris/actions-gh-pages@v3
77
74
with :
78
75
github_token : ${{ github.token }}
79
- publish_dir : ./ public
76
+ publish_dir : public/${{ steps.get-pr-number.outputs.pr_number }}
80
77
publish_branch : gh-pages
81
- destination_dir : ${{ steps.source-run-info.outputs.pullRequestNumber || 'main' }}/
82
-
78
+ destination_dir : ${{ steps.get-pr-number.outputs.pr_number }}
79
+
80
+
83
81
- name : Create or update PR comment
84
- if : steps.source-run-info .outputs.pullRequestNumber
82
+ if : steps.get-pr-number .outputs.pr_number != 'main'
85
83
uses : peter-evans/create-or-update-comment@v3
86
84
with :
87
- token : ${{ secrets.GITHUB_TOKEN }}
88
- issue-number : ${{ steps.source-run-info.outputs.pullRequestNumber }}
89
- body : |
90
- Preview the changes for PR #${{ steps.source-run-info.outputs.pullRequestNumber }} (${{ github.event.workflow_run.head_sha }}) here: https://gh.cp-algorithms.com/${{ steps.source-run-info.outputs.pullRequestNumber }}/
85
+ token : ${{ github.token }}
86
+ issue-number : ${{ steps.get-pr-number.outputs.pr_number }}
87
+ body : ' Preview the changes for PR #${{ steps.get-pr-number.outputs.pr_number }} (${{ github.event.workflow_run.head_sha }}) [here](https://gh.cp-algorithms.com/${{ steps.get-pr-number.outputs.pr_number }}/).'
91
88
body-includes : ' Preview the changes for PR'
92
89
mode : replace
0 commit comments