Skip to content

Commit c6da1da

Browse files
authored
Add reusable workflow
1 parent 7c46dfd commit c6da1da

File tree

2 files changed

+45
-27
lines changed

2 files changed

+45
-27
lines changed

.github/workflows/python-312.yml

+4-27
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,7 @@ on:
99

1010
jobs:
1111
sync:
12-
runs-on: ubuntu-latest
13-
env:
14-
LOCALE: zh_CN
15-
VERSION: "3.12"
16-
steps:
17-
- uses: actions/checkout@v3
18-
- name: Checkout CPython
19-
uses: actions/checkout@v3
20-
with:
21-
repository: 'python/cpython'
22-
ref: ${{env.VERSION}}
23-
path: cpython
24-
- name: Checkout Current Branch
25-
uses: actions/checkout@v3
26-
with:
27-
ref: ${{env.VERSION}}
28-
path: docs
29-
- name: prepare
30-
run: .github/scripts/prepare.sh
31-
- name: update
32-
run: .github/scripts/update.sh
33-
env:
34-
TX_TOKEN: ${{ secrets.TRANSIFEX_APIKEY }}
35-
- name: build
36-
run: .github/scripts/build.sh
37-
- name: commit
38-
run: .github/scripts/commit.sh
12+
uses: ./.github/workflows/sync.yml
13+
with:
14+
version: "3.12"
15+
secrets: inherit

.github/workflows/sync.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Reusable workflow example
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
version:
7+
required: true
8+
type: string
9+
secrets:
10+
TRANSIFEX_APIKEY:
11+
required: true
12+
13+
jobs:
14+
sync:
15+
runs-on: ubuntu-latest
16+
env:
17+
LOCALE: zh_CN
18+
VERSION: ${{ inputs.version }}
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Checkout CPython
22+
uses: actions/checkout@v3
23+
with:
24+
repository: 'python/cpython'
25+
ref: ${{env.VERSION}}
26+
path: cpython
27+
- name: Checkout Current Branch
28+
uses: actions/checkout@v3
29+
with:
30+
ref: ${{env.VERSION}}
31+
path: docs
32+
- name: prepare
33+
run: .github/scripts/prepare.sh
34+
- name: update
35+
run: .github/scripts/update.sh
36+
env:
37+
TX_TOKEN: ${{ secrets.TRANSIFEX_APIKEY }}
38+
- name: build
39+
run: .github/scripts/build.sh
40+
- name: commit
41+
run: .github/scripts/commit.sh

0 commit comments

Comments
 (0)