diff --git a/.circleci/config.yml b/.circleci/config.yml index 8718055..8873932 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,49 +1,48 @@ version: 2.1 orbs: - # Replace this with your own! nx: nrwl/nx@<> orb-tools: circleci/orb-tools@10.0 # Pipeline Parameters ## These parameters are used internally by orb-tools. Skip to the Jobs section. parameters: + # These pipeline parameters are required by the "trigger-integration-tests-workflow" + # job, by default. run-integration-tests: - description: An internal flag to prevent integration test from running before a development version has been created. type: boolean default: false dev-orb-version: - description: > - The development version of the orb to test. - This value is automatically adjusted by the "trigger-integration-tests-workflow" job to correspond with the specific version created by the commit and should not be edited. - A "dev:alpha" version must exist for the initial pipeline run. type: string default: "dev:alpha" jobs: - # Define one or more jobs which will utilize your orb's commands and parameters to validate your changes. set-shas-integration-test: docker: - - image: cimg/node:14.17-browsers + - image: cimg/base:stable steps: - checkout + - nx/greetme - nx/set-shas workflows: - # Prior to producing a development orb (which requires credentials) basic validation, linting, and even unit testing can be performed. - # This workflow will run on every commit test-pack: unless: << pipeline.parameters.run-integration-tests >> jobs: - - orb-tools/lint # Lint Yaml files - - orb-tools/pack # Pack orb source + - orb-tools/lint + - orb-tools/pack: + use-orb-pack: true + - hold-for-dev-publish: + type: approval + requires: + - orb-tools/lint + - orb-tools/pack # Publish development version(s) of the orb. - orb-tools/publish-dev: orb-name: nrwl/nx context: orb-publishing # A restricted context containing your private publishing credentials. Will only execute if approved by an authorized user. requires: - - orb-tools/lint - - orb-tools/pack + - hold-for-dev-publish # Trigger an integration workflow to test the # dev:${CIRCLE_SHA1:0:7} version of your orb - orb-tools/trigger-integration-tests-workflow: @@ -70,13 +69,12 @@ workflows: - orb-tools/dev-promote-prod-from-commit-subject: orb-name: nrwl/nx context: orb-publishing - add-pr-comment: false + add-pr-comment: true fail-if-semver-not-indicated: true - publish-version-tag: false + publish-version-tag: true requires: - set-shas-integration-test filters: branches: only: - - master - main diff --git a/src/commands/greetme.yml b/src/commands/greetme.yml new file mode 100644 index 0000000..03db1b7 --- /dev/null +++ b/src/commands/greetme.yml @@ -0,0 +1,23 @@ +description: > + Derives SHAs for base and head for use in `nx affected` commands in CI + +parameters: + main-branch-name: + type: string + default: main + description: > + The name of the main branch in your repo, used as the target of PRs. E.g. main, master etc. + error-on-no-successful-workflow: + type: boolean + default: false + description: > + By default, if no successful workflow is found on the main branch to determine the SHA, + we will log a warning and use HEAD~1. Enable this option to error and exit instead. +steps: + - run: + environment: + PARAM_MAIN_BRANCH: <> + PARAM_ERROR_ON_NO_SUCCESSFUL_WORKFLOW: <> + name: Derives SHAs for base and head for use in `nx affected` commands + shell: "/bin/bash" + command: echo "I was done"