|
1 | 1 | name: Deployment
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - branches: [main] |
6 |
| - tags: [v*] |
7 |
| - workflow_dispatch: |
8 |
| - inputs: |
9 |
| - reason: |
10 |
| - description: Reason for the workflow dispatch. Only "release" is valid. |
11 |
| - required: true |
12 |
| - default: release |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + tags: [v*] |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + reason: |
| 10 | + description: Reason for the workflow dispatch. Only "release" is valid. |
| 11 | + required: true |
| 12 | + default: release |
13 | 13 |
|
14 | 14 | jobs:
|
15 |
| - deploy: |
16 |
| - if: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.reason == 'release') || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) }} |
17 |
| - runs-on: ubuntu-latest |
18 |
| - steps: |
19 |
| - - name: Checkout code |
20 |
| - uses: actions/checkout@v3 |
21 |
| - with: |
22 |
| - fetch-depth: 0 |
23 |
| - |
24 |
| - - name: Set up Python 3.10 |
25 |
| - uses: actions/setup-python@v4 |
26 |
| - with: |
27 |
| - python-version: "3.10" |
28 |
| - |
29 |
| - - name: Install hatch |
30 |
| - run: pip install hatch |
31 |
| - |
32 |
| - # this will fail if the last commit is not tagged |
33 |
| - - name: Build project for distribution |
34 |
| - run: hatch build |
35 |
| - |
36 |
| - - name: Publish on PyPI |
37 |
| - uses: pypa/gh-action-pypi-publish@release/v1 |
38 |
| - with: |
39 |
| - user: __token__ |
40 |
| - password: ${{ secrets.PYPI_TOKEN }} |
41 |
| - skip_existing: true |
42 |
| - verbose: true |
43 |
| - |
44 |
| - sync-branches: |
45 |
| - if: ${{ github.event_name == 'workflow_dispatch' }} |
46 |
| - needs: deploy |
47 |
| - runs-on: ubuntu-latest |
48 |
| - steps: |
49 |
| - - uses: actions/checkout@v3 |
50 |
| - - name: Extract branch name |
51 |
| - id: vars |
52 |
| - run: | |
53 |
| - echo ::set-output name=branch::${GITHUB_REF#refs/*/} |
54 |
| -
|
55 |
| - - name: Merge release into main |
56 |
| - |
57 |
| - with: |
58 |
| - github_token: ${{ secrets.RELEASE_DISPATCH_TOKEN }} |
59 |
| - target_branch: main |
60 |
| - commit_message_template: ${{ format('[auto][ci skip] Merge branch ''{0}'' into main', steps.vars.outputs.branch) }} |
| 15 | + deploy: |
| 16 | + if: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.reason == 'release') || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) }} |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v3 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + |
| 24 | + - name: Set up Python 3.10 |
| 25 | + uses: actions/setup-python@v4 |
| 26 | + with: |
| 27 | + python-version: "3.10" |
| 28 | + |
| 29 | + - name: Install hatch |
| 30 | + run: pip install hatch |
| 31 | + |
| 32 | + # this will fail if the last commit is not tagged |
| 33 | + - name: Build project for distribution |
| 34 | + run: hatch build |
| 35 | + |
| 36 | + - name: Publish on PyPI |
| 37 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 38 | + with: |
| 39 | + user: __token__ |
| 40 | + password: ${{ secrets.PYPI_TOKEN }} |
| 41 | + skip-existing: true |
| 42 | + verbose: true |
| 43 | + |
| 44 | + sync-branches: |
| 45 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 46 | + needs: deploy |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v3 |
| 50 | + - name: Extract branch name |
| 51 | + id: vars |
| 52 | + run: | |
| 53 | + echo ::set-output name=branch::${GITHUB_REF#refs/*/} |
| 54 | +
|
| 55 | + - name: Merge release into main |
| 56 | + |
| 57 | + with: |
| 58 | + github_token: ${{ secrets.RELEASE_DISPATCH_TOKEN }} |
| 59 | + target_branch: main |
| 60 | + commit_message_template: ${{ format('[auto][ci skip] Merge branch ''{0}'' into main', steps.vars.outputs.branch) }} |
0 commit comments