-
Notifications
You must be signed in to change notification settings - Fork 56
chore: merge prerelease into publish-v2 job #1421
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
daniel-graham-amplitude
wants to merge
10
commits into
main
Choose a base branch
from
no-ticket/oidc-pre-release
base: main
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.
Open
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8e86338
chore: merge prerelease into publish-v2 job
daniel-graham-amplitude 8f4a281
again
daniel-graham-amplitude 774d03a
Update .github/workflows/publish-v2.yml
daniel-graham-amplitude bc7f1bc
move build and test steps into a helper
daniel-graham-amplitude ddc04c1
again
daniel-graham-amplitude b900e68
again
daniel-graham-amplitude 8add761
again
daniel-graham-amplitude 2580d7e
again
daniel-graham-amplitude 81df507
Merge branch 'main' of github.com:amplitude/Amplitude-TypeScript into…
daniel-graham-amplitude 14e9442
again
daniel-graham-amplitude 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 was deleted.
Oops, something went wrong.
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 |
|---|---|---|
|
|
@@ -3,9 +3,18 @@ name: Publish v2.x | |
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| releaseType: | ||
| type: choice | ||
| description: Release type (release for main branch, prerelease for feature branches) | ||
| required: true | ||
| default: release | ||
| options: | ||
| - release | ||
| - prerelease | ||
| - dry-run | ||
| publishFrom: | ||
| type: string | ||
| description: Publish source (leave empty for from-git, or enter "from-package") | ||
| description: Publish source (leave empty for from-git, or enter "from-package"). Only applies to 'release' type. | ||
| required: false | ||
|
|
||
| jobs: | ||
|
|
@@ -24,6 +33,7 @@ jobs: | |
| name: Deploy | ||
| runs-on: ubuntu-latest | ||
| needs: [authorize] | ||
| if: ${{ github.event.inputs.releaseType == 'release' }} | ||
| permissions: | ||
| id-token: write # Required for OIDC | ||
| contents: write | ||
|
|
@@ -119,3 +129,95 @@ jobs: | |
| GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} npm run deploy:publish -- ${{ env.PUBLISH_FROM }} -y --pre-dist-tag beta --loglevel silly | ||
| env: | ||
| S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} | ||
|
|
||
| prerelease: | ||
| name: Prerelease feature branch | ||
| runs-on: ubuntu-latest | ||
| needs: [authorize] | ||
| if: ${{ github.event.inputs.releaseType != 'release' }} | ||
| permissions: | ||
| id-token: write # Required for OIDC | ||
| contents: write | ||
| strategy: | ||
| matrix: | ||
| node-version: [24.x] # Ensure npm 11.5.1 or later is installed for OIDC, node 24.6 is minimal | ||
|
|
||
| steps: | ||
| - name: Get branch name | ||
| id: branch-name | ||
| uses: tj-actions/branch-name@v7 | ||
|
|
||
| - name: Check out git repository | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| ref: ${{ steps.branch-name.outputs.ref_branch }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: '**/node_modules' | ||
| key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
|
||
| - name: Setup Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Install project dependencies | ||
| run: | | ||
| yarn install --frozen-lockfile | ||
|
|
||
daniel-graham-amplitude marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - name: Build all packages | ||
| run: | | ||
| yarn build | ||
|
|
||
| - name: Test all packages | ||
| run: | | ||
| yarn test | ||
|
|
||
| - name: Lint all packages | ||
| run: | | ||
| yarn lint | ||
|
|
||
| - name: Configure Git User | ||
| run: | | ||
| git config --global user.name amplitude-sdk-bot | ||
| git config --global user.email [email protected] | ||
|
|
||
| - name: Configure AWS Credentials | ||
| uses: aws-actions/configure-aws-credentials@v2 | ||
| with: | ||
| role-to-assume: arn:aws:iam::358203115967:role/github-actions-role | ||
| aws-region: us-west-2 | ||
|
|
||
| # Keep alphanumeric characters and hyphens, remove other invalid characters | ||
| # Examples: | ||
| # - SR-1858 -> SR-1858 | ||
| # - feature/my-branch -> featuremy-branch | ||
| # - fix_bug_123 -> fixbug123 | ||
| # - [email protected] -> usercompanycom | ||
| - name: Transform feature branch name | ||
| run: | | ||
| echo "PREID=$(echo '${{ steps.branch-name.outputs.current_branch }}' | tr -cd '[:alnum:]-')" >> $GITHUB_ENV | ||
|
|
||
| # Use --no-push to prevent pushing to remote | ||
| # Version example: 1.0.0 -> 1.1.0-{preid}.0 | ||
| - name: Dry run pre-release version | ||
| if: ${{ github.event.inputs.releaseType == 'dry-run' }} | ||
| run: | | ||
| GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} npm run deploy:version -- -y --no-private --conventional-prerelease --preid ${{ env.PREID }} --allow-branch ${{ steps.branch-name.outputs.current_branch }} --no-changelog --no-push --no-git-tag-version | ||
|
|
||
| - name: Pre-release version | ||
| if: ${{ github.event.inputs.releaseType == 'prerelease' }} | ||
| run: | | ||
| GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} npm run deploy:version -- -y --no-private --conventional-prerelease --preid ${{ env.PREID }} --allow-branch ${{ steps.branch-name.outputs.current_branch }} --create-release github | ||
|
|
||
| # Use 'from git' option if `lerna version` has already been run | ||
| - name: Publish Release to NPM | ||
| if: ${{ github.event.inputs.releaseType == 'prerelease' }} | ||
| run: | | ||
| GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} npm run deploy:publish -- from-git -y --ignore-scripts --pre-dist-tag ${{ env.PREID }} | ||
| env: | ||
| S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} | ||
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.