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

Conversation

flochaz
Copy link
Contributor

@flochaz flochaz commented Dec 29, 2021

Description of your changes

Implement #366 proposal 1:

Pre release

Release

  • trigger: manually

  • Github commit:

    • commit created with
      • git tag 0.3.0
      • package.json version bumbed with 0.3.0
      • changelog.md: extra line with changes merged since last release tag
  • Github release: created (0.3.0) and same data as changelog

  • npm: published (0.3.0)

  • Doc: published under (0.3.0)

Tests

Pre-release tested on a modified trigger:

PR status

Is this ready for review?: YES
Is it a breaking change?: NO

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • The code coverage hasn't decreased
  • I have added tests that prove my change is effective and works
  • New and existing unit tests pass locally and in Github Actions
  • Any dependent changes have been merged and published in downstream module
  • The PR title follows the conventional commit semantics

Breaking change checklist

  • I have documented the migration process
  • I have added, implemented necessary warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@dreamorosi dreamorosi added the automation This item relates to automation label Dec 29, 2021
@dreamorosi dreamorosi added this to the beta-release milestone Dec 29, 2021
@flochaz flochaz force-pushed the feat/cicd/prodWorkflow branch from 0852a72 to 5a91078 Compare December 29, 2021 14:43
@flochaz flochaz force-pushed the feat/cicd/prodWorkflow branch from c2f6170 to a69f6ce Compare December 30, 2021 15:36
npx lerna version --conventional-commits --conventional-prerelease --preid beta --force-publish=* --yes --no-changelog
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

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

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

@flochaz flochaz mentioned this pull request Dec 30, 2021
23 tasks
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"

Comment on lines 70 to 76
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"

Comment on lines 55 to 58
- 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

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

Comment on lines 88 to 94
- 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

@flochaz flochaz requested review from ijemmy and saragerion January 4, 2022 10:00
ijemmy
ijemmy previously approved these changes Jan 4, 2022
Copy link
Contributor

@ijemmy ijemmy left a comment

Choose a reason for hiding this comment

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

Approved. I have just one question.

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
Copy link
Contributor

Choose a reason for hiding this comment

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

(minor) The summary of issue you are trying to solve will be nice here.

By "recommendation", do you mean adding the --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.

adding details

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@saragerion saragerion left a comment

Choose a reason for hiding this comment

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

Nice to have - can we incorporate this workflow: https://github.com/awslabs/aws-lambda-powertools-typescript/blob/d8fd2c1f74501ce5558057171742bd0eafdc55de/.github/workflows/release-drafter.yml
in your on-merge-to-main file here?

I know why they were implemented separated, but in my mind they are triggered by the same event and are part of the same workflow.

@flochaz flochaz requested a review from ijemmy January 4, 2022 14:16
@flochaz flochaz merged commit f84d0af into main Jan 4, 2022
@flochaz flochaz deleted the feat/cicd/prodWorkflow branch January 4, 2022 18:28
flochaz added a commit that referenced this pull request Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation This item relates to automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants