Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves: Add a CI/CD pipeline with GitHub Actions #1057

Merged
merged 16 commits into from Oct 20, 2021

Conversation

aleks-ivanov
Copy link
Contributor

@aleks-ivanov aleks-ivanov commented Aug 24, 2021

The pipeline runs:

  1. CI - the build job executes on every push commit, every PR and when the pipeline is run manually
  • build and unit tests validation
  • logs generation
  • uploading artifacts to pipeline run (checkout the PR run of the pipeline for artifact download)
  1. CD - the deploy job executes only on a push commit to the default branch, that contains a new version in the package.json
  • deployment to production - an npm access token with type Automation is required, which should be stored as a repo secret with the name NPM_TOKEN
  • GitHub tag and release creation
    • a GItHub user email and user name are required for the push of the GitHub tag. Add them as repo secrets with the following names GH_USER_EMAIL and GH_USER_NAME
    • entry in the CHANGELOG.md for the new version is required for the release creation, otherwise the execution of the pipeline exits with an error and no release is created (example test release)

The sh-semversion-2 tool is used in the Project version/deploy determiner task to compare package version and GitHub tags

Please let us know if anything could be done better and/or if any other automation is required by the project! We would be happy to improve it to satisfactory completion 馃檪

Resolves #1056

name: "Logs ${{ matrix.os }} - nodejs ${{ matrix.node-version }}"
path: logs/

deploy:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This entire step should be left out, I believe.

Terser is still published to NPM by hand, and moving to a flow like that should at least be a separate PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @fabiosantoscode
to be sure I understood you correctly, you would like the build and deploy jobs to be on separate PRs ?

Something like this:

  • PR-1
name: CI/CD pipeline

on: [ push, pull_request, workflow_dispatch ]

jobs:
  build:
    name: "Build ${{ matrix.os }} node${{ matrix.node-version }}"
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ ubuntu-latest, windows-latest ]
        node-version: [ 10.x, 12.x, 14.x, 16.x ]
    outputs:
      package_version: ${{ steps.proj_ver_determiner.outputs.package_version }}
      package_version_tag: ${{ steps.proj_ver_determiner.outputs.package_version_tag }}
      latest_github_tag: ${{ steps.proj_ver_determiner.outputs.latest_github_tag }}
      should_deploy: ${{ steps.proj_ver_determiner.outputs.should_deploy }}
    steps:
    ...
  • PR-2
+++
deploy:
    if: needs.build.outputs.should_deploy == 'true'
    needs: build
    runs-on: ubuntu-latest
    steps:
    ...

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think there shouldn't be a deploy step for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood.

We'll make the changes promptly 馃檪

@fabiosantoscode
Copy link
Collaborator

Hello there!

I left just one comment, otherwise this looks good!

@fabiosantoscode
Copy link
Collaborator

Hey! Sorry I'm late! This looks good to go. Thanks!

@fabiosantoscode fabiosantoscode merged commit e61a299 into terser:master Oct 20, 2021
@aleks-ivanov aleks-ivanov deleted the feature/ci-cd branch October 20, 2021 08:23
@mishina2228 mishina2228 mentioned this pull request Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a CI/CD pipeline with GitHub Actions
2 participants