-
Notifications
You must be signed in to change notification settings - Fork 10
ci: harden supply chain security for release pipelines #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+81
−43
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fe2befc
ci: harden supply chain security for release pipelines
zhukaihan a229316
ci: set experiment-sdk as CODEOWNERS for all files
zhukaihan 1d808cb
chore: update release pipeline
zhukaihan 4ecaeff
ci: SHA-pin semantic-release action and remove redundant pip install
zhukaihan e29ea14
ci: explicit read only permission
zhukaihan 0babec8
ci: add prerelease for test
zhukaihan f86fa8c
ci: alpha tag for non master branch
zhukaihan 951a410
ci: remove prerelease config from ci
zhukaihan f643d95
ci: move step around for dry run
zhukaihan 31396ec
ci: rename release dry run
zhukaihan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Default: require experiment-sdk team review for all files | ||
| * @amplitude/experiment-sdk | ||
|
zhukaihan marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: ${{ github.actor }} permission check to do a release | ||
| uses: "lannonbr/repo-permission-check-action@2.0.2" | ||
| uses: lannonbr/repo-permission-check-action@2bb8c89ba8bf115c4bfab344d6a6f442b24c9a1f # 2.0.2 | ||
| with: | ||
| permission: "write" | ||
| env: | ||
|
|
@@ -18,23 +18,43 @@ jobs: | |
| name: Build and publish to TestPyPI | ||
| runs-on: ubuntu-latest | ||
| needs: [authorize] | ||
| environment: Unit Test | ||
|
zhukaihan marked this conversation as resolved.
zhukaihan marked this conversation as resolved.
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Checkout for release to PyPI | ||
| uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | ||
|
Comment on lines
25
to
+27
|
||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Python 3.8 | ||
| uses: actions/setup-python@v6 | ||
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 | ||
| with: | ||
| python-version: 3.8 | ||
|
|
||
| - name: Install dependencies | ||
| run: python -m pip install build setuptools wheel twine amplitude_analytics parameterized | ||
| run: python -m pip install build setuptools wheel twine amplitude_analytics parameterized python-dotenv~=0.21.1 | ||
|
|
||
| - name: Install requirements | ||
| run: pip install -r requirements.txt && pip install -r requirements-dev.txt | ||
|
|
||
| - name: Run Test | ||
| env: | ||
| API_KEY: ${{ secrets.API_KEY }} | ||
| SECRET_KEY: ${{ secrets.SECRET_KEY }} | ||
| EU_API_KEY: ${{ secrets.EU_API_KEY }} | ||
| EU_SECRET_KEY: ${{ secrets.EU_SECRET_KEY }} | ||
| run: python -m unittest discover -s ./tests -p '*_test.py' | ||
|
|
||
| - name: Build a binary wheel and a source tarball | ||
| run: python -m build --sdist --wheel --outdir dist/ . | ||
| - name: Publish distribution PyPI --dry-run | ||
| uses: python-semantic-release/python-semantic-release@350c48fcb3ffcdfd2e0a235206bc2ecea6b69df0 # v10.5.3 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| push: false | ||
| vcs_release: false | ||
|
|
||
| - name: Publish distribution Test PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| - name: Publish to Test PyPI | ||
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | ||
| with: | ||
| user: __token__ | ||
| password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
| repository_url: https://test.pypi.org/legacy/ | ||
| repository-url: https://test.pypi.org/legacy/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,20 @@ | ||
| [tool.semantic_release] | ||
| version_variable = [ | ||
| version_variables = [ | ||
| "src/amplitude_experiment/version.py:__version__" | ||
| ] | ||
| major_on_zero = true | ||
| branch = "main" | ||
| upload_to_PyPI = true | ||
| upload_to_release = true | ||
| build_command = "pip install build && python -m build" | ||
| version_source = "commit" | ||
| commit_version_number = true | ||
| commit_subject = "chore(release): Bump version to {version}" | ||
| commit_message = "chore(release): Bump version to {version}" | ||
| commit_author = "amplitude-sdk-bot <amplitude-sdk-bot@users.noreply.github.com>" | ||
|
|
||
| [tool.semantic_release.publish] | ||
| upload_to_vcs_release = true | ||
|
|
||
|
zhukaihan marked this conversation as resolved.
|
||
| [tool.semantic_release.branches.main] | ||
| match = "(main|master)" | ||
| prerelease = false | ||
|
|
||
| [tool.semantic_release.branches.alpha] | ||
| match = "^(?!.*main|master).*$" | ||
| prerelease = true | ||
| prerelease_token = "alpha" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.