-
Notifications
You must be signed in to change notification settings - Fork 6
Create adk-release-to-prod-preview workflow #268
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
2 commits
Select commit
Hold shift + click to select a range
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,48 @@ | ||
| # This workflow will build and run tests using node and then publish a package to the public NPM repository | ||
| # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | ||
|
|
||
| name: adk-release-delete | ||
|
|
||
| on: [workflow_dispatch] | ||
|
|
||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| SSH_PUBLIC_KEY: ${{ secrets.SSH_PUBLIC_KEY }} | ||
| SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
| GIT_COMMITTER_NAME: ActionsDevKitRelease | ||
| GIT_COMMITTER_EMAIL: cawsactionextensions+adk-release@amazon.com | ||
|
|
||
| jobs: | ||
| release-to-prod: | ||
| runs-on: ubuntu-latest | ||
aj-aws marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| permissions: write-all | ||
| steps: | ||
| # Setup .npmrc file to publish to npm | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 16 | ||
| registry-url: 'https://registry.npmjs.org/' | ||
| scope: '@aws' | ||
| # Install dependencies | ||
| - run: npm install --global lerna@5.0.0 yarn@1.22.18 | ||
| - run: lerna --version | ||
| - run: yarn --version | ||
| - run: npm --version | ||
|
|
||
| # Un-Publishes ADK package from NPM (order matters) | ||
| # https://docs.npmjs.com/policies/unpublish | ||
| - run: npm unpublish codecatalyst-adk@$UNPUBLISH_NPM_VERSION | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| - run: npm unpublish codecatalyst-adk-core@$UNPUBLISH_NPM_VERSION | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| - run: npm unpublish codecatalyst-project@$UNPUBLISH_NPM_VERSION | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| - run: npm unpublish codecatalyst-adk-model-parser@$UNPUBLISH_NPM_VERSION | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| - run: npm unpublish codecatalyst-adk-utils@$UNPUBLISH_NPM_VERSION | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
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,77 @@ | ||
| # This workflow will build and run tests using node and then publish a package to the public NPM repository | ||
| # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | ||
|
|
||
| name: adk-release-to-prod-preview | ||
|
|
||
| on: [workflow_dispatch] | ||
|
|
||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| SSH_PUBLIC_KEY: ${{ secrets.SSH_PUBLIC_KEY }} | ||
| SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
| GIT_COMMITTER_NAME: ActionsDevKitRelease | ||
| GIT_COMMITTER_EMAIL: cawsactionextensions+adk-release@amazon.com | ||
|
|
||
| jobs: | ||
| release-to-prod: | ||
| runs-on: ubuntu-latest | ||
| permissions: write-all | ||
| steps: | ||
| # Allows to push to the main branch for | ||
| - name: Git & SSH auth setup | ||
| run: | | ||
| sudo git config --system --add safe.directory "*" | ||
| if [[ -n $SSH_PUBLIC_KEY && -n $SSH_PRIVATE_KEY ]]; then | ||
| echo "SSH Key pair found, configuring signing..." | ||
| mkdir ~/.ssh | ||
| echo -e "$SSH_PRIVATE_KEY" >> ~/.ssh/signing_key | ||
| cat ~/.ssh/signing_key | ||
| echo -e "$SSH_PUBLIC_KEY" >> ~/.ssh/signing_key.pub | ||
| cat ~/.ssh/signing_key.pub | ||
| chmod 600 ~/.ssh/signing_key && chmod 600 ~/.ssh/signing_key.pub | ||
| eval "$(ssh-agent)" | ||
| ssh-add ~/.ssh/signing_key | ||
| git config --global gpg.format ssh | ||
| git config --global user.signingKey ~/.ssh/signing_key | ||
| git config --global commit.gpgsign true | ||
| git config --global user.email $GIT_COMMITTER_EMAIL | ||
| git config --global user.name $GIT_COMMITTER_NAME | ||
| touch ~/.ssh/allowed_signers | ||
| echo "$GIT_COMMITTER_EMAIL $SSH_PUBLIC_KEY" > ~/.ssh/allowed_signers | ||
| git config --global gpg.ssh.allowedSignersFile ~/.ssh/allowed_signers | ||
| fi | ||
| # Checkout main branch | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| # Checkout with ssh key to be able to push changes back to the branch. | ||
| # The expected changes are: | ||
| # - a version bump in the package.json files | ||
| # - and ./lerna.json | ||
| # - changes in changelogs | ||
| ssh-key: ${{ env.SSH_PRIVATE_KEY }} | ||
| # Setup .npmrc file to publish to npm | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 16 | ||
| registry-url: 'https://registry.npmjs.org/' | ||
| scope: '@aws' | ||
| # Install dependencies | ||
| - run: npm install --global lerna@5.0.0 yarn@1.22.18 | ||
| - run: lerna --version | ||
| - run: yarn --version | ||
| - run: npm --version | ||
|
|
||
| # Runs `yarn install` and prepare all the packages in this monorepo for the build | ||
| - run: yarn install | ||
| # Builds and tests all the packages | ||
| - run: yarn run all | ||
| # Upgrades major|minor|patch version for all the packages even if there's no changes in some or all of them. | ||
| # Publishes the version as a preview using conventional-prelease | ||
| # Follows https://www.conventionalcommits.org/en/v1.0.0/ | ||
| - run: lerna version --conventional-commits --conventional-prerelease --force-publish --yes | ||
| - run: git status | ||
| - run: git pull | ||
| # Publishes ADK packages to CodeArtifact | ||
| - run: lerna publish from-package --yes | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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.