|
15 | 15 | name: Release Candidate |
16 | 16 |
|
17 | 17 | on: |
18 | | - pull_request: |
19 | | - types: [opened, synchronize, closed] |
20 | | - # Allow workflow to be triggered manually. |
21 | | - workflow_dispatch: |
| 18 | + pull_request: |
| 19 | + types: [opened, synchronize, closed] |
| 20 | + # Allow workflow to be triggered manually. |
| 21 | + workflow_dispatch: |
22 | 22 |
|
23 | 23 | jobs: |
24 | | - stage_release: |
25 | | - # To publish a release, merge the release PR with the label 'release:publish'. |
26 | | - # To stage a release without publishing it, manually invoke the workflow. |
27 | | - # . or apply the 'release:stage' label to a PR. |
28 | | - if: > |
29 | | - (github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release:publish')) || |
30 | | - github.event.workflow_dispatch || |
31 | | - (!github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release:stage')) |
32 | | -
|
33 | | - runs-on: ubuntu-latest |
34 | | - |
35 | | - steps: |
36 | | - - name: Checkout source for staging |
37 | | - uses: actions/checkout@v3 |
38 | | - |
39 | | - - name: Set up Python |
40 | | - uses: actions/setup-python@v4 |
41 | | - with: |
42 | | - python-version: '3.10' |
43 | | - |
44 | | - - name: Install dependencies |
45 | | - run: | |
46 | | - pip install --upgrade pip |
47 | | - python -m pip install -e ".[dev]" |
48 | | -
|
49 | | - - name: Test with pytest & coverage |
50 | | - run: | |
51 | | - python -m pytest --cov=src --cov-report term --cov-report html --cov-report xml -vv |
52 | | -
|
53 | | - # Build the Python Wheel and the source distribution. |
54 | | - - name: Package release artifacts |
55 | | - run: | |
56 | | - python -m pip install setuptools wheel |
57 | | - python setup.py bdist_wheel sdist |
58 | | -
|
59 | | - # Attach the packaged artifacts to the workflow output. These can be manually |
60 | | - # downloaded for later inspection if necessary. |
61 | | - - name: Archive artifacts |
62 | | - uses: actions/upload-artifact@v3 |
63 | | - with: |
64 | | - name: dist |
65 | | - path: dist/ |
66 | | - |
67 | | - publish_release: |
68 | | - needs: stage_release |
69 | | - |
70 | | - # Check whether the release should be published. We publish only when the trigger PR is |
71 | | - # 1. merged |
72 | | - # 2. to the main branch |
73 | | - # 3. with the label 'release:publish', and |
74 | | - # 4. the title prefix 'chore: Release '. |
75 | | - if: > |
76 | | - github.event.pull_request.merged && |
77 | | - github.ref == 'refs/heads/main' && |
78 | | - contains(github.event.pull_request.labels.*.name, 'release:publish') && |
79 | | - startsWith(github.event.pull_request.title, 'chore: Release ') |
80 | | -
|
81 | | - runs-on: ubuntu-latest |
82 | | - |
83 | | - permissions: |
84 | | - # Used to create a short-lived OIDC token which is given to PyPi to identify this workflow job |
85 | | - # See: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings |
86 | | - # and https://docs.pypi.org/trusted-publishers/using-a-publisher/ |
87 | | - id-token: write |
88 | | - contents: write |
89 | | - |
90 | | - steps: |
91 | | - - name: Checkout source for publish |
92 | | - uses: actions/checkout@v4 |
93 | | - |
94 | | - # Download the artifacts created by the stage_release job. |
95 | | - - name: Download release candidates |
96 | | - |
97 | | - with: |
98 | | - name: dist |
99 | | - path: dist |
100 | | - |
101 | | - - name: Publish preflight check |
102 | | - id: preflight |
103 | | - run: ./.github/scripts/publish_preflight_check.sh |
104 | | - |
105 | | - # We pull this action from a custom fork of a contributor until |
106 | | - # https://github.com/actions/create-release/pull/32 is merged. Also note that v1 of |
107 | | - # this action does not support the "body" parameter. |
108 | | - - name: Create release tag |
109 | | - # Skip creating a release tag for prereleases |
110 | | - if: (!contains(github.event.pull_request.labels.*.name, 'release:prerelease')) |
111 | | - uses: fleskesvor/create-release@1a72e235c178bf2ae6c51a8ae36febc24568c5fe |
112 | | - env: |
113 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
114 | | - with: |
115 | | - tag_name: ${{ steps.preflight.outputs.version }} |
116 | | - release_name: Firebase Functions Python SDK ${{ steps.preflight.outputs.version }} |
117 | | - body: ${{ steps.preflight.outputs.changelog }} |
118 | | - draft: false |
119 | | - prerelease: false |
120 | | - |
121 | | - - name: Publish to Pypi |
122 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
| 24 | + stage_release: |
| 25 | + # To publish a release, merge the release PR with the label 'release:publish'. |
| 26 | + # To stage a release without publishing it, manually invoke the workflow. |
| 27 | + # . or apply the 'release:stage' label to a PR. |
| 28 | + if: > |
| 29 | + (github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release:publish')) || |
| 30 | + github.event.workflow_dispatch || |
| 31 | + (!github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'release:stage')) |
| 32 | +
|
| 33 | + runs-on: ubuntu-latest |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Checkout source for staging |
| 37 | + uses: actions/checkout@v3 |
| 38 | + |
| 39 | + - name: Set up Python |
| 40 | + uses: actions/setup-python@v4 |
| 41 | + with: |
| 42 | + python-version: '3.10' |
| 43 | + |
| 44 | + - name: Install dependencies |
| 45 | + run: | |
| 46 | + pip install --upgrade pip |
| 47 | + python -m pip install -e ".[dev]" |
| 48 | +
|
| 49 | + - name: Test with pytest & coverage |
| 50 | + run: | |
| 51 | + python -m pytest --cov=src --cov-report term --cov-report html --cov-report xml -vv |
| 52 | +
|
| 53 | + # Build the Python Wheel and the source distribution. |
| 54 | + - name: Package release artifacts |
| 55 | + run: | |
| 56 | + python -m pip install setuptools wheel |
| 57 | + python setup.py bdist_wheel sdist |
| 58 | +
|
| 59 | + # Attach the packaged artifacts to the workflow output. These can be manually |
| 60 | + # downloaded for later inspection if necessary. |
| 61 | + - name: Archive artifacts |
| 62 | + uses: actions/upload-artifact@v4 |
| 63 | + with: |
| 64 | + name: dist |
| 65 | + path: dist/ |
| 66 | + |
| 67 | + publish_release: |
| 68 | + needs: stage_release |
| 69 | + |
| 70 | + # Check whether the release should be published. We publish only when the trigger PR is |
| 71 | + # 1. merged |
| 72 | + # 2. to the main branch |
| 73 | + # 3. with the label 'release:publish', and |
| 74 | + # 4. the title prefix 'chore: Release '. |
| 75 | + if: > |
| 76 | + github.event.pull_request.merged && |
| 77 | + github.ref == 'refs/heads/main' && |
| 78 | + contains(github.event.pull_request.labels.*.name, 'release:publish') && |
| 79 | + startsWith(github.event.pull_request.title, 'chore: Release ') |
| 80 | +
|
| 81 | + runs-on: ubuntu-latest |
| 82 | + |
| 83 | + permissions: |
| 84 | + # Used to create a short-lived OIDC token which is given to PyPi to identify this workflow job |
| 85 | + # See: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings |
| 86 | + # and https://docs.pypi.org/trusted-publishers/using-a-publisher/ |
| 87 | + id-token: write |
| 88 | + contents: write |
| 89 | + |
| 90 | + steps: |
| 91 | + - name: Checkout source for publish |
| 92 | + uses: actions/checkout@v4 |
| 93 | + |
| 94 | + # Download the artifacts created by the stage_release job. |
| 95 | + - name: Download release candidates |
| 96 | + |
| 97 | + with: |
| 98 | + name: dist |
| 99 | + path: dist |
| 100 | + |
| 101 | + - name: Publish preflight check |
| 102 | + id: preflight |
| 103 | + run: ./.github/scripts/publish_preflight_check.sh |
| 104 | + |
| 105 | + # We pull this action from a custom fork of a contributor until |
| 106 | + # https://github.com/actions/create-release/pull/32 is merged. Also note that v1 of |
| 107 | + # this action does not support the "body" parameter. |
| 108 | + - name: Create release tag |
| 109 | + # Skip creating a release tag for prereleases |
| 110 | + if: (!contains(github.event.pull_request.labels.*.name, 'release:prerelease')) |
| 111 | + uses: fleskesvor/create-release@1a72e235c178bf2ae6c51a8ae36febc24568c5fe |
| 112 | + env: |
| 113 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 114 | + with: |
| 115 | + tag_name: ${{ steps.preflight.outputs.version }} |
| 116 | + release_name: Firebase Functions Python SDK ${{ steps.preflight.outputs.version }} |
| 117 | + body: ${{ steps.preflight.outputs.changelog }} |
| 118 | + draft: false |
| 119 | + prerelease: false |
| 120 | + |
| 121 | + - name: Publish to Pypi |
| 122 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments