Skip to content

chore(cicd): Create release workflow following #366 discussion proposal 1 #369

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 18 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/on-release-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: release
on:
push:
branches:
- main
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be renamed to on-release-dev.yml ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, describing the trigger event: "on-merge-to-main"

workflow_dispatch: {}
jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
token: ${{ secrets.GH_PUBLISH_TOKEN }}
fetch-depth: 0
#########################
# Release new version
#########################
- name: "Use NodeJS 14"
uses: actions/setup-node@v2
with:
node-version: '14'
- name: "Setup npm"
run: |
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
- name: Install packages
run: |
npm ci
npm run lerna-ci
- name: Run lint
run: npm run lerna-lint
- name: Run tests
run: npm run lerna-test
- 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

# Follow https://github.com/lerna/lerna/issues/2248#issuecomment-527882069 recommendation
npx lerna version --conventional-commits --conventional-prerelease --preid beta --force-publish=* --yes --no-changelog
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
npx lerna version --conventional-commits --conventional-prerelease --preid beta --force-publish=* --yes --no-changelog
npx lerna version --conventional-commits --conventional-prerelease --preid dev --force-publish=* --yes --no-changelog

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want changelog but populating unreleased section

git push --delete origin $(git describe --abbrev=0)

npx lerna publish from-package --no-verify-access --yes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not publish to npm for intermediary version

Suggested change
npx lerna publish from-package --no-verify-access --yes

#########################
# Generate documentation
#########################
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.8'
- name: Set RELEASE_VERSION env var
run: |
RELEASE_VERSION=$(cat packages/commons/package.json | jq '.version' -r)
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in discussion, let's only publish the new version when we do full release. For this one, we can just put this in main. Thus, we don't need this version number.

Suggested change
- name: Set RELEASE_VERSION env var
run: |
RELEASE_VERSION=$(cat packages/commons/package.json | jq '.version' -r)
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 yep, as agreed during the meeting, in the "merge-to-main" process we will not publish to NPM and not create a github release

- 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="${{ env.RELEASE_VERSION }}"
ALIAS="latest"
echo "Publishing doc for version: $VERSION"
mkdocs build
mike deploy --push --update-aliases "$VERSION" "$ALIAS"
# Set latest version as a default
mike set-default --push latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to publish tomain.

Suggested change
VERSION="${{ env.RELEASE_VERSION }}"
ALIAS="latest"
echo "Publishing doc for version: $VERSION"
mkdocs build
mike deploy --push --update-aliases "$VERSION" "$ALIAS"
# Set latest version as a default
mike set-default --push latest
VERSION="main"
ALIAS="latest"
echo "Publishing doc for version: $VERSION"
mkdocs build
mike deploy --push --update-aliases "$VERSION" "$ALIAS"

- 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: ${{ env.RELEASE_VERSION }}/api
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll copy the API to main/api

Suggested change
destination_dir: ${{ env.RELEASE_VERSION }}/api
destination_dir: main/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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this as we don't need to copy API doc to any other folder beside main (done in the last step)

Suggested change
- 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

Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: release
on:
push:
branches:
- main
workflow_dispatch: {}
jobs:
publish:
Expand Down Expand Up @@ -39,12 +36,7 @@ jobs:
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

if [ ${{ github.base_ref }} = main ]; then
npx lerna version --conventional-commits --create-release github --force-publish=* --yes
else
npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes
fi
npx lerna version --conventional-commits --conventional-graduate --create-release github --force-publish=* --yes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
npx lerna version --conventional-commits --conventional-graduate --create-release github --force-publish=* --yes
npx lerna version --conventional-commits --conventional-graduate --preid beta --create-release github --force-publish=* --yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to test preid on graduate

npx lerna publish from-git --no-verify-access --yes
#########################
# Generate documentation
Expand Down
203 changes: 0 additions & 203 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,203 +0,0 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.2.0-beta.13](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.2.0-beta.12...v0.2.0-beta.13) (2021-12-29)


### Bug Fixes

* don't redirect from latest to the actual version ([237ad3a](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/237ad3a5e4b56d217f90da6172688de6aa7d12a7))


### Features

* switch color to deep orange ([a13d22a](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/a13d22aacfc1f47b73bd508972b016198873ceef))





# [0.2.0-beta.12](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.2.0-beta.11...v0.2.0-beta.12) (2021-12-28)

**Note:** Version bump only for package aws-lambda-powertools-typescript





# [0.2.0-beta.11](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.2.0-beta.10...v0.2.0-beta.11) (2021-12-28)


### Bug Fixes

* Remove publishing doc on `develop` version and fix missing leading 0 in version ([#356](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/356)) ([44991bc](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/44991bcdf0842274333928da3cc12052624808eb))





# [0.2.0-beta.10](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.2.0-beta.9...v0.2.0-beta.10) (2021-12-28)


### Features

* generate new version of doc for each release ([#355](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/355)) ([9f45ee1](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/9f45ee12ceced39acc2cc69934a10f18cb95a161))





# [0.2.0-beta.9](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.2.0-beta.8...v0.2.0-beta.9) (2021-12-28)

**Note:** Version bump only for package aws-lambda-powertools-typescript





# [0.2.0-beta.8](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.2.0-beta.7...v0.2.0-beta.8) (2021-12-28)

**Note:** Version bump only for package aws-lambda-powertools-typescript





# [0.2.0-beta.7](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.2.0-beta.6...v0.2.0-beta.7) (2021-12-27)


### Features

* **metrics:** logMetrics middleware ([#338](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/338)) ([f8cf705](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/f8cf7055de78e4515ffbae5de5867649a38dc17d))





# [0.2.0-beta.6](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.2.0-beta.5...v0.2.0-beta.6) (2021-12-23)

**Note:** Version bump only for package aws-lambda-powertools-typescript





# [0.2.0-beta.5](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.2.0-beta.4...v0.2.0-beta.5) (2021-12-21)

**Note:** Version bump only for package aws-lambda-powertools-typescript





# [0.2.0-beta.4](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.2.0-beta.3...v0.2.0-beta.4) (2021-12-21)

**Note:** Version bump only for package aws-lambda-powertools-typescript





# [0.2.0-beta.3](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.2.0-beta.2...v0.2.0-beta.3) (2021-12-17)

**Note:** Version bump only for package aws-lambda-powertools-typescript





# [0.2.0-beta.2](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.2.0-beta.1...v0.2.0-beta.2) (2021-12-17)

**Note:** Version bump only for package aws-lambda-powertools-typescript





# [0.2.0-beta.1](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.2.0-beta.0...v0.2.0-beta.1) (2021-12-17)

**Note:** Version bump only for package aws-lambda-powertools-typescript





# [0.2.0-beta.0](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.1.1-beta.0...v0.2.0-beta.0) (2021-12-17)


### Features

* **tracer:** middy middleware ([#324](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/324)) ([2909d6f](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/2909d6f9b9bf1a570f950e17f0d49acbe63653ee))





# [0.1.0-beta.9](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.1.0-beta.8...v0.1.0-beta.9) (2021-12-15)


### Bug Fixes

* **metrics:** lib entrypoint ([819098b](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/819098b9e820d0998b6116b659dd456ae65ba20a))





# [0.1.0-beta.8](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.1.0-beta.7...v0.1.0-beta.8) (2021-12-15)

**Note:** Version bump only for package aws-lambda-powertools-typescript





# 0.1.0-beta.7 (2021-12-15)


### Bug Fixes

* **cicd:** Fix/release ([#323](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/323)) ([9df4493](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/9df449370c1441d3c9d7165bc3b161a15dd2e1de))
* **ci:** merge conflict ([97796df](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/97796df7cb7036396459279224d64bd277651e71))
* **ci:** updated github actions commands ([76ba8c7](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/76ba8c76c33db5eba44a50c015880520f04bb54c))
* **ci:** updated NPM dependencies (audit) ([3166c7b](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/3166c7b7c58baa8414121c73f15139f4db0ccf38))
* hosted-git-info bump in logger ([fb2a365](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/fb2a365cc73ae60d6e32d46361265a5ee8f5cad1))
* **logger:** jest set to next version as workaround for vulnerability ([0f423bf](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/0f423bf7479a28829e81fabc6c58ed4e76dcfda4))
* **logging:** removed forgotten dummy folder ([a10791f](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/a10791f5201739ab2f5f7019bbc52ea04cb0d723))
* **metrics:** publish metrics even if handler throw ([#249](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/249)) ([8ad0a6a](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/8ad0a6ac388641a41da08fefee48f6b996544a0a))
* upgrade of dependencies, npm-shrinkwrap for packages/logger ([c120c64](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/c120c64670ac3ed86438267c0a9c9fc72a3f7ebe))
* version bumb for commitlint/cli ([0e1f6be](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/0e1f6be2786779ca43c3fcac6cb9e96431ca585d))


### Features

* add metrics ([#102](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/102)) ([cf22210](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/cf22210ebb519cf0a625a2bdc92d2bcea7b4a59d))
* Adding sample automation for PR ([#121](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/121)) ([7bf63bb](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/7bf63bb8554972f30b450c1cbf100aea2b580162))
* **logger:** add context decorator functionality ([#13](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/13)) ([369e4d1](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/369e4d1595776f4c563b1e9eb803897677df041f))
* **logger:** adding basic crude logger module, and support for log levels by passed param/env param ([a3ff0ba](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/a3ff0bab8f89a51dc3953cdbdcd5cd74aac6db0a))
* **logger:** basic logger logic ([#9](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/9)) ([5f867ea](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/5f867ea8dc43bd315a27d051993625fa699d514a)), closes [#10](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/10)
* **logger:** lint error fixes ([5272ac0](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/5272ac0c12bbfe23395429f8a239f90ac8676b15))
* **logging:** added basic lerna package for the logging module ([14c679d](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/14c679da949cd4b4ef5cd076ce1a7da5132c3cde))





# Changelog

All notable changes to this project will be documented in this file.

This project follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format for changes and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [Unreleased]

## 0.1.0

### Features

* **tracer:** beta release ([#91](https://github.com/awslabs/aws-lambda-powertools-python/issues/91))
* **logger:** beta release ([#24](https://github.com/awslabs/aws-lambda-powertools-python/issues/24))
* **metrics:** beta release ([#25](https://github.com/awslabs/aws-lambda-powertools-python/issues/25))