1212 if : github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push'
1313 steps :
1414 - name : Checkout repository
15- uses : actions/checkout@v3
15+ uses : actions/checkout@v4
16+
17+ - name : Attach run to the commit
18+ uses : ./.github/actions/set-commit-status
19+ with :
20+ sha : ${{ github.event.workflow_run.head_sha }}
21+ status : pending
1622
1723 - name : Download pages
1824 uses : actions/download-artifact@v4
3137 with :
3238 credentials_json : ' ${{ secrets.GCP_CREDENTIALS }}'
3339
34- - uses : google-github-actions/upload-cloud-storage@v1
40+ - uses : google-github-actions/upload-cloud-storage@v2.2.0
3541 with :
3642 path : public/search/search_index.json
3743 destination : cp-algorithms
@@ -44,12 +50,24 @@ jobs:
4450 projectId : cp-algorithms
4551 channelId : live
4652
53+ - name : Set final commit status
54+ uses : ./.github/actions/set-commit-status
55+ if : always()
56+ with :
57+ sha : ${{ github.event.workflow_run.head_sha }}
58+
4759 deploy_github_pages :
4860 runs-on : ubuntu-latest
4961 if : github.event.workflow_run.conclusion == 'success'
5062 steps :
5163 - name : Checkout repository
52- uses : actions/checkout@v3
64+ uses : actions/checkout@v4
65+
66+ - name : Attach run to the commit
67+ uses : ./.github/actions/set-commit-status
68+ with :
69+ sha : ${{ github.event.workflow_run.head_sha }}
70+ status : pending
5371
5472 - name : Download pages
5573 uses : actions/download-artifact@v4
@@ -62,25 +80,18 @@ jobs:
6280 id : get-pr-number
6381 run : echo "pr_number=$(ls public)" >> $GITHUB_OUTPUT
6482
65- - name : Configure git
66- run : |
67- git config --global user.name "github-actions[bot]"
68- git config --global user.email "github-actions[bot]@users.noreply.github.com"
69-
7083 - name : Deploy to gh-pages
71- uses : peaceiris/actions-gh-pages@v3
84+ uses : peaceiris/actions-gh-pages@v4
7285 with :
7386 github_token : ${{ github.token }}
87+ user_name : github-actions[bot]
88+ user_email : github-actions[bot]@users.noreply.github.com
7489 publish_dir : public/${{ steps.get-pr-number.outputs.pr_number }}
75- publish_branch : gh-pages
7690 destination_dir : ${{ steps.get-pr-number.outputs.pr_number }}
91+ full_commit_message : " Preview for ${{ steps.get-pr-number.outputs.pr_number != 'main' && '#' || '' }}${{ steps.get-pr-number.outputs.pr_number }} (${{ github.event.workflow_run.head_sha }}) at https://gh.cp-algorithms.com/${{ steps.get-pr-number.outputs.pr_number }}/"
7792
78- - name : Create or update PR comment
79- if : steps.get-pr-number.outputs.pr_number != 'main'
80- uses : peter-evans/create-or-update-comment@v3
93+ - name : Set final commit status
94+ uses : ./.github/actions/set-commit-status
95+ if : always()
8196 with :
82- token : ${{ github.token }}
83- issue-number : ${{ steps.get-pr-number.outputs.pr_number }}
84- body : ' Preview the changes for PR #${{ steps.get-pr-number.outputs.pr_number }} at https://gh.cp-algorithms.com/${{ steps.get-pr-number.outputs.pr_number }}/ (current version: ${{ github.event.workflow_run.head_sha }}).'
85- body-includes : ' Preview the changes for PR'
86- mode : replace
97+ sha : ${{ github.event.workflow_run.head_sha }}
0 commit comments