Skip to content

Commit cb9fc90

Browse files
authored
Merge branch 'main' into master
2 parents e547697 + 91672f0 commit cb9fc90

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+530
-291
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# .github/actions/set-commit-status/action.yml
2+
name: 'Set Commit Status'
3+
description: 'Sets the commit status for a given SHA'
4+
inputs:
5+
sha:
6+
description: 'The commit SHA to update the status for'
7+
required: true
8+
status:
9+
description: 'The status to set (pending, success, failure, error)'
10+
default: ${{ job.status }}
11+
context:
12+
description: 'The context for the status check'
13+
default: '${{ github.workflow }} / ${{ github.job }} (${{ github.event.workflow_run.event }})'
14+
token:
15+
description: 'GitHub token'
16+
default: ${{ github.token }}
17+
runs:
18+
using: 'composite'
19+
steps:
20+
- name: Set commit status
21+
uses: myrotvorets/set-commit-status-action@v2.0.1
22+
with:
23+
sha: ${{ inputs.sha }}
24+
token: ${{ inputs.token }}
25+
status: ${{ inputs.status }}
26+
context: ${{ inputs.context }}
27+
description: ${{ inputs.status }}

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212

1313
steps:
1414
- name: Checkout repository
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
1818
submodules: recursive
1919
- name: Set up Python
20-
uses: actions/setup-python@v2
20+
uses: actions/setup-python@v5.2.0
2121
with:
22-
python-version: '3.8'
22+
python-version: '3.11'
2323
- name: Install mkdocs-material
2424
run: |
2525
scripts/install-mkdocs.sh

.github/workflows/delete-preview.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
name: Delete PR Preview
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [closed]
66

77
jobs:
88
delete_pr_preview:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout gh-pages branch
12-
uses: actions/checkout@v3
12+
uses: actions/checkout@v4
1313
with:
1414
ref: gh-pages
1515

@@ -22,5 +22,5 @@ jobs:
2222
run: |
2323
PR_DIR=${{ github.event.pull_request.number }}
2424
git rm -r --ignore-unmatch "${PR_DIR}/" || echo "Directory not found"
25-
git commit -m "Delete preview for PR #${{ github.event.pull_request.number }}"
25+
git commit -m "Delete preview for #${{ github.event.pull_request.number }}"
2626
git push origin gh-pages

.github/workflows/deploy-cloud-function.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout repository
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414

1515
- uses: dorny/paths-filter@v2
1616
id: changes

.github/workflows/deploy-prod.yml

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ jobs:
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
@@ -31,7 +37,7 @@ jobs:
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 }}

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111

1212
steps:
1313
- name: Checkout repository
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515
- name: Set up Python
16-
uses: actions/setup-python@v2
16+
uses: actions/setup-python@v5.2.0
1717
with:
1818
python-version: '3.8'
1919
- name: Set up C++

0 commit comments

Comments
 (0)