-
Notifications
You must be signed in to change notification settings - Fork 0
[EC3-2437] Move optimizely-platform to Artifact Registry #1
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
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3a6a899
[EC3-2437] Move optimizely-platform to Artifact Registry
EshtiakAlam 5618eee
Remove download_url from setup.py
EshtiakAlam 7e9c365
- Fix artipacked vulnerability by disabling persist-credentials in ch…
EshtiakAlam 39ce388
- Enhance publish workflow: add validation for GitHub Release and tag…
EshtiakAlam 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,79 @@ | ||
| name: Release and Publish to Google Artifact Registry | ||
|
EshtiakAlam marked this conversation as resolved.
|
||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*.*.*" | ||
|
|
||
| jobs: | ||
| publish-gar: | ||
| name: Build and Publish to GAR | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
arnica-github-connector[bot] marked this conversation as resolved.
|
||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Validate tag format | ||
| env: | ||
| TAG: ${{ github.ref_name }} | ||
| run: | | ||
| VERSION="${TAG#v}" | ||
| if ! [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| echo "Error: Invalid version format '$VERSION'. Expected format: x.y.z" | ||
| exit 1 | ||
| fi | ||
| echo "Releasing version: $VERSION (from tag: $TAG)" | ||
|
ahmedrafayat marked this conversation as resolved.
|
||
|
|
||
| - name: Verify GitHub Release exists | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| TAG: ${{ github.ref_name }} | ||
| run: | | ||
| if ! gh release view "$TAG" --repo "$GITHUB_REPOSITORY" > /dev/null 2>&1; then | ||
| echo "Error: No GitHub Release found for tag '$TAG'." | ||
| echo "Create a release via GitHub UI instead of pushing tags manually." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Verify tag is on master | ||
| env: | ||
| DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | ||
| run: | | ||
| git fetch origin "$DEFAULT_BRANCH" --quiet | ||
| if ! git merge-base --is-ancestor "$GITHUB_SHA" "origin/$DEFAULT_BRANCH"; then | ||
| echo "Error: Tag commit $GITHUB_SHA is not reachable from origin/$DEFAULT_BRANCH." | ||
| echo "Only tags on the $DEFAULT_BRANCH branch can be published." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.x" | ||
|
|
||
| - name: Install build dependencies | ||
| run: pip install build twine setuptools-scm | ||
|
|
||
| - name: Authenticate to Google Cloud | ||
| id: auth | ||
| uses: google-github-actions/auth@v3 | ||
| with: | ||
| token_format: "access_token" | ||
| workload_identity_provider: "projects/668763687485/locations/global/workloadIdentityPools/github/providers/github" | ||
| service_account: "github-experimentation@optimizely-iac.iam.gserviceaccount.com" | ||
|
|
||
| - name: Build and Publish | ||
| run: | | ||
| python -m build | ||
| python -m twine upload \ | ||
| --repository-url https://us-east1-python.pkg.dev/artifact-registry-e3ca/private-python/ \ | ||
| --username oauth2accesstoken \ | ||
| --password ${{ steps.auth.outputs.access_token }} \ | ||
| dist/* | ||
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,5 +1,10 @@ | ||
| # optimizely-platform [](https://travis-ci.org/optimizely/optimizely-platform) | ||
| # optimizely-platform | ||
|
|
||
| A Python package providing modules needed to build add-ons that run natively in the Optimizely platform. | ||
|
|
||
| TODO(jon): Add link to documentation once it's up. | ||
| ## Releasing | ||
|
|
||
| 1. Merge your changes to `master`. | ||
| 2. [Create a GitHub Release](../../releases/new) with a tag in the format `vX.Y.Z` (e.g. `v1.2.3`). | ||
|
|
||
| The `publish.yaml` workflow builds and publishes to Google Artifact Registry. It will reject tags that aren't strict semver, lack a GitHub Release, or aren't on `master`. |
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
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.