-
Notifications
You must be signed in to change notification settings - Fork 153
fix(layers): release process + remove duplicate code #1052
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
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 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 was deleted.
Oops, something went wrong.
This file contains 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,57 @@ | ||
name: Make Release | ||
on: | ||
workflow_dispatch: {} | ||
concurrency: | ||
group: on-release-publish | ||
jobs: | ||
run-unit-tests: | ||
uses: ./.github/workflows/reusable-run-unit-tests.yml | ||
publish-npm: | ||
needs: run-unit-tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
# Here `token` is needed to avoid incurring in error GH006 Protected Branch Update Failed, | ||
token: ${{ secrets.GH_PUBLISH_TOKEN }} | ||
# While `fetch-depth` is used to allow the workflow to later commit & push the changes. | ||
fetch-depth: 0 | ||
- name: Setup NodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
cache: "npm" | ||
- name: Setup npm | ||
run: | | ||
npm i -g npm@next-8 | ||
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" | ||
- name: Cache node modules | ||
id: cache-node-modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: "./node_modules" | ||
# Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that | ||
# if one of them changes the cache is invalidated/discarded | ||
key: 16-cache-utils-node-modules-${{ hashFiles('./package-lock.json') }} | ||
- name: Build packages | ||
run: | | ||
npm run build -w packages/commons | ||
npm run build -w packages/logger & npm run build -w packages/tracer & npm run build -w packages/metrics | ||
- name: "Version and publish" | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_PUBLISH_TOKEN }} | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY | ||
npx lerna version --conventional-commits --force-publish --yes | ||
npx lerna publish from-git --no-verify-access --yes | ||
publish: | ||
needs: publish-npm | ||
uses: ./.github/workflows/reusable-publish-docs.yml | ||
with: | ||
workflow_origin: ${{ github.event.repository.full_name }} | ||
isRelease: "true" | ||
secrets: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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 |
---|---|---|
|
@@ -5,6 +5,8 @@ on: | |
workflows: ["Record PR details"] | ||
types: | ||
- completed | ||
concurrency: | ||
group: on-merge-to-main | ||
|
||
jobs: | ||
get_pr_details: | ||
|
@@ -15,10 +17,30 @@ jobs: | |
workflow_origin: ${{ github.event.repository.full_name }} | ||
secrets: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
run-unit-tests: | ||
uses: ./.github/workflows/reusable-run-unit-tests.yml | ||
publish: | ||
needs: | ||
[get_pr_details, run-unit-tests, check-examples, check-layer-publisher] | ||
uses: ./.github/workflows/reusable-publish-docs.yml | ||
with: | ||
workflow_origin: ${{ github.event.repository.full_name }} | ||
prIsMerged: ${{ needs.get_pr_details.outputs.prIsMerged }} | ||
secrets: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
update-release-draft: | ||
needs: publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Update release draft | ||
uses: release-drafter/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
release_label_on_merge: | ||
needs: get_pr_details | ||
needs: [get_pr_details, update-release-draft] | ||
runs-on: ubuntu-latest | ||
if: needs.get_pr_details.outputs.prIsMerged == 'true' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: "Label PR related issue for release" | ||
|
@@ -33,98 +55,3 @@ jobs: | |
script: | | ||
const script = require('.github/scripts/label_related_issue.js') | ||
await script({github, context, core}) | ||
publish: | ||
######################### | ||
# Force Github action to run only a single job at a time (based on the group name) | ||
# This is to prevent "race-condition" in publishing a new version of doc to `gh-pages` (#365) | ||
######################### | ||
concurrency: | ||
group: on-merge-to-main | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
######################### | ||
# Release new version | ||
######################### | ||
- name: "Use NodeJS 16" | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
- name: Install [email protected] | ||
run: npm i -g npm@next-8 | ||
- name: "Setup npm" | ||
run: | | ||
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" | ||
- name: Install monorepo packages | ||
# This installs all the dependencies of ./packages/* | ||
# See https://github.com/npm/cli/issues/4475 to see why --foreground-scripts | ||
run: npm ci --foreground-scripts | ||
- name: Install CDK example packages | ||
# Since we are not managing the CDK examples with npm workspaces we install | ||
# the dependencies in a separate step | ||
working-directory: ./examples/cdk | ||
run: npm ci | ||
- name: Install Layer publisher app | ||
working-directory: ./layer-publisher | ||
run: npm ci | ||
- name: "Setup SAM" | ||
# We use an ad-hoc action so we can specify the SAM CLI version | ||
uses: aws-actions/setup-sam@v2 | ||
with: | ||
version: 1.49.0 | ||
- name: Install SAM example packages | ||
# Since we are not managing the SAM examples with npm workspaces we install | ||
# the dependencies in a separate step | ||
working-directory: ./examples/sam | ||
run: npm ci | ||
- name: Run lint | ||
run: npm run lerna-lint | ||
- name: Run tests | ||
run: npm run lerna-test | ||
- name: Update release draft | ||
uses: release-drafter/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
######################### | ||
# Generate documentation | ||
######################### | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.8' | ||
- name: Install doc generation dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install -r docs/requirements.txt | ||
- name: Setup doc deploy | ||
run: | | ||
git config --global user.name Docs deploy | ||
git config --global user.email [email protected] | ||
- name: Build mkdocs site in "gh-pages" branch and push | ||
run: | | ||
rm -rf site | ||
VERSION="dev" | ||
echo "Publishing doc for version: $VERSION" | ||
mkdocs build | ||
mike deploy --push "$VERSION" | ||
- name: Build API docs | ||
run: | | ||
rm -rf api | ||
npm run docs-generateApiDoc | ||
- name: Release API docs to the released version | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./api | ||
keep_files: true | ||
destination_dir: dev/api | ||
- name: Release API docs to the "latest" version | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./api | ||
keep_files: true | ||
destination_dir: latest/api |
This file was deleted.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line was interpreted by the workflow as an actual issue number. The workflow was then trying to assign a label to it but since it doesn't exist it would fail.