-
Notifications
You must be signed in to change notification settings - Fork 32
Automate drafting releases #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
Open
bob2681312
wants to merge
11
commits into
aws:master
Choose a base branch
from
bob2681312:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+153
−4
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c78ac61
Add automation to drafting python release
bob2681312 b0b576d
Add call to PR workflow
bob2681312 ccc682a
test
bob2681312 0c1fd54
test pr
bob2681312 9e8eed6
reenable code cov
bob2681312 ed518ca
Add some comments
bob2681312 c97b2ef
Rename Yaml
bob2681312 666f548
Add a Publish Release Workflow
bob2681312 0ca5238
add release
bob2681312 59b6bf3
Add version comments
bob2681312 9b12b3c
Add new publish-test environment
bob2681312 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
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,67 @@ | ||
| # Create a new release with the specified version | ||
|
|
||
| name: Create New Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'Release version (must be in format <MAJOR>.<MINOR>.<PATCH>, e.g. 1.1.1)' | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| verify-input: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | ||
| - name: Verify input | ||
| env: | ||
| VERSION: ${{ inputs.version }} | ||
| run: | | ||
| # Make sure the input matches the intended format | ||
| SEMVER_REGEX="^([0-9]+)\.([0-9]+)\.([0-9]+)$" | ||
| if [[ ! "$VERSION" =~ $SEMVER_REGEX ]]; then | ||
| echo "::error::Invalid version format '$VERSION'. Must match X.Y.Z (e.g., 1.0.4)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| TAG="v$VERSION" | ||
|
|
||
| # Fail if the tag already exists | ||
| if git ls-remote --tags origin | grep -q "refs/tags/$TAG"; then | ||
| echo "Error: Tag $TAG already exists. Aborting." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Creating Tag $TAG ..." | ||
|
|
||
| run-test: | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| needs: verify-input | ||
| uses: ./.github/workflows/python-package.yml | ||
|
|
||
| draft-release: | ||
| needs: run-test | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| environment: release | ||
| steps: | ||
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | ||
| - name: Draft release v${{ inputs.version }} | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| VERSION: ${{ inputs.version }} | ||
| run: | | ||
| gh release create "v$VERSION" \ | ||
| --title "v$VERSION" \ | ||
|
bob2681312 marked this conversation as resolved.
|
||
| --generate-notes \ | ||
| --target "$GITHUB_SHA" | ||
|
|
||
| echo "Drafted release v$VERSION" | ||
|
|
||
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,81 @@ | ||
| # This workflow will publish the python binaries to PyPI | ||
|
|
||
| name: Publish Release | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| release-build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | ||
|
|
||
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | ||
| with: | ||
| python-version: "3.x" | ||
|
|
||
| - name: build release distributions | ||
| run: | | ||
| # NOTE: put your own distribution build steps here. | ||
| pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| pip install build wheel setuptools | ||
| python setup.py install | ||
| python -m build | ||
|
|
||
| - name: upload artifacts | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | ||
| with: | ||
| name: release-dists | ||
|
bob2681312 marked this conversation as resolved.
|
||
| path: dist/ | ||
|
|
||
| pypi-publish-test: | ||
|
bob2681312 marked this conversation as resolved.
|
||
| runs-on: ubuntu-latest | ||
| environment: publish-test | ||
| needs: | ||
| - release-build | ||
| permissions: | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: Retrieve release distributions | ||
| uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5 | ||
| with: | ||
| name: release-dists | ||
| path: dist/ | ||
|
|
||
| - name: Publish release distributions to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/717ba43cfbb0387f6ce311b169a825772f54d295 # v1 | ||
| with: | ||
| repository-url: https://test.pypi.org/legacy/ | ||
|
|
||
| READ-PLEASE: | ||
| runs-on: ubuntu-latest | ||
| needs: pypi-publish-test | ||
| steps: | ||
| - name: Review Instructuons (PLEASE READ) | ||
| run: | | ||
| echo "Please do the following before approving release for prod." | ||
| echo "Go to https://test.pypi.org/project/aws-secretsmanager-caching/" | ||
| echo "Check the page for completeness. There should be a new version published, and two artifacts in the "Download files" section: a wheel (.whl) and a source distribution (.tar.gz)" | ||
|
|
||
| pypi-publish: | ||
| runs-on: ubuntu-latest | ||
| environment: publish # Will act as a temporary blocker that the invoker can self-approve so that they would check if the binaries uploaded properly | ||
|
bob2681312 marked this conversation as resolved.
|
||
| needs: | ||
| - READ-PLEASE | ||
| permissions: | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: Retrieve release distributions | ||
| uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5 | ||
| with: | ||
| name: release-dists | ||
| path: dist/ | ||
|
|
||
| - name: Publish release distributions to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/717ba43cfbb0387f6ce311b169a825772f54d295 # v1 | ||
|
|
||
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
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.