-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This merge sunsets the CircleCI deployment workflow and replaces it with a GHA workflow.
- Loading branch information
Showing
4 changed files
with
119 additions
and
65 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,69 @@ | ||
# version: 2.1 | ||
# orbs: | ||
# commitlint: conventional-changelog/[email protected] | ||
# node: circleci/[email protected] | ||
|
||
version: 2.1 | ||
orbs: | ||
commitlint: conventional-changelog/[email protected] | ||
node: circleci/[email protected] | ||
# jobs: | ||
# build-and-test: | ||
# executor: | ||
# name: node/default | ||
# resource_class: medium | ||
# tag: '16.19' | ||
# steps: | ||
# - checkout | ||
# - node/install-packages | ||
# - run: npm run build | ||
# - run: npm run test | ||
# - persist_to_workspace: | ||
# root: ~/project | ||
# paths: | ||
# - . | ||
# deploy: | ||
# executor: | ||
# name: node/default | ||
# resource_class: medium | ||
# tag: '16.19' | ||
# steps: | ||
# - attach_workspace: | ||
# at: ~/project | ||
# - run: npm run semantic-release | ||
|
||
jobs: | ||
build-and-test: | ||
executor: | ||
name: node/default | ||
resource_class: medium | ||
tag: '16.19' | ||
steps: | ||
- checkout | ||
- node/install-packages | ||
- run: npm run build | ||
- run: npm run test | ||
- persist_to_workspace: | ||
root: ~/project | ||
paths: | ||
- . | ||
deploy: | ||
executor: | ||
name: node/default | ||
resource_class: medium | ||
tag: '16.19' | ||
steps: | ||
- attach_workspace: | ||
at: ~/project | ||
- run: npm run semantic-release | ||
# workflows: | ||
# commitlint: | ||
# when: | ||
# not: | ||
# or: | ||
# - equal: [ master, <<pipeline.git.branch>> ] | ||
# - equal: [ develop, <<pipeline.git.branch>> ] | ||
# - matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> } | ||
# - matches: { pattern: "^release.*", value: <<pipeline.git.branch>> } | ||
# jobs: | ||
# - commitlint/lint: | ||
# target-branch: develop | ||
|
||
workflows: | ||
commitlint: | ||
when: | ||
not: | ||
or: | ||
- equal: [ master, <<pipeline.git.branch>> ] | ||
- equal: [ develop, <<pipeline.git.branch>> ] | ||
- matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> } | ||
- matches: { pattern: "^release.*", value: <<pipeline.git.branch>> } | ||
jobs: | ||
- commitlint/lint: | ||
target-branch: develop | ||
# build-and-test-workflow: | ||
# when: | ||
# not: | ||
# or: | ||
# - equal: [ master, <<pipeline.git.branch>> ] | ||
# - equal: [ develop, <<pipeline.git.branch>> ] | ||
# - matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> } | ||
# - matches: { pattern: "^release.*", value: <<pipeline.git.branch>> } | ||
# jobs: | ||
# - build-and-test | ||
|
||
build-and-test-workflow: | ||
when: | ||
not: | ||
or: | ||
- equal: [ master, <<pipeline.git.branch>> ] | ||
- equal: [ develop, <<pipeline.git.branch>> ] | ||
- matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> } | ||
- matches: { pattern: "^release.*", value: <<pipeline.git.branch>> } | ||
jobs: | ||
- build-and-test | ||
# deploy-workflow: | ||
# when: | ||
# or: | ||
# - equal: [ master, <<pipeline.git.branch>> ] | ||
# - equal: [ develop, <<pipeline.git.branch>> ] | ||
# - matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> } | ||
# - matches: { pattern: "^release.*", value: <<pipeline.git.branch>> } | ||
|
||
deploy-workflow: | ||
when: | ||
or: | ||
- equal: [ master, <<pipeline.git.branch>> ] | ||
- equal: [ develop, <<pipeline.git.branch>> ] | ||
- matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> } | ||
- matches: { pattern: "^release.*", value: <<pipeline.git.branch>> } | ||
|
||
jobs: | ||
- build-and-test | ||
- deploy: | ||
context: | ||
- scratch-npm-creds | ||
requires: | ||
- build-and-test | ||
# jobs: | ||
# - build-and-test | ||
# - deploy: | ||
# context: | ||
# - scratch-npm-creds | ||
# requires: | ||
# - build-and-test |
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 @@ | ||
@scratchfoundation/scratch-engineering |
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,53 @@ | ||
name: CI/CD | ||
|
||
on: | ||
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab | ||
pull_request: # Runs whenever a pull request is created or updated | ||
push: # Runs whenever a commit is pushed to the repository | ||
branches: [master, develop, hotfix/*, release] | ||
|
||
concurrency: | ||
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: write # publish a GitHub release | ||
pages: write # deploy to GitHub Pages | ||
issues: write # comment on released issues | ||
pull-requests: write # comment on released pull requests | ||
|
||
jobs: | ||
ci-cd: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: wagoid/commitlint-github-action@v5 | ||
if: github.event_name == 'pull_request' | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: "npm" | ||
node-version-file: ".nvmrc" | ||
|
||
- name: Info | ||
run: | | ||
cat <<EOF | ||
Node version: $(node --version) | ||
NPM version: $(npm --version) | ||
GitHub ref: ${{ github.ref }} | ||
GitHub head ref: ${{ github.head_ref }} | ||
EOF | ||
- name: Setup & Test | ||
run: | | ||
npm ci | ||
npm run build | ||
npm run test | ||
- name: Semantic release (configured to run dry if branch is other than 'develop') | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
npx --no -- semantic-release |
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 @@ | ||
v16 |