Skip to content

Commit

Permalink
Switch to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dankelleher committed Sep 9, 2024
1 parent bd8248b commit 9783015
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 1,280 deletions.
5 changes: 5 additions & 0 deletions .changeset/shaggy-falcons-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@civic/credential-commons": patch
---

Switch to github actions
124 changes: 0 additions & 124 deletions .circleci/config.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .circleci/install_hub.sh

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI Pipeline

on:
push:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache node_modules
uses: actions/cache@v4
with:
path: node_modules
key: v1-dependencies-${{ hashFiles('package.json', 'yarn.lock') }}

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run tests with coverage
run: yarn test

- name: Lint code
run: yarn lint

- name: Build project
run: yarn build

- name: Save dist folder as artifact
uses: actions/upload-artifact@v4
with:
name: dist-artifact
path: dist/
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn

- name: Install Dependencies
run: yarn --frozen-lockfile

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

# - name: Send a Slack notification if a publish happens
# if: steps.changesets.outputs.published == 'true'
# # You can do something when a publish happens.
# run: my-slack-bot send-notification --message "A new version of ${GITHUB_REPOSITORY} was published!"
21 changes: 9 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,23 @@
"browser": "dist/browser/index.js",
"scripts": {
"lint": "eslint . --ext .ts --max-warnings=0",
"lint:fix": "npm run lint -- --fix",
"test": "npm run build:ts && cross-env NODE_ENV=test jest",
"lint:fix": "yarn lint -- --fix",
"test": "yarn build:ts && cross-env NODE_ENV=test jest",
"test:watch": "jest --watch",
"check": "npm run lint && npm run test",
"check": "yarn lint && yarn test",
"generate-civic-config": "cross-env NODE_ENV=test node scripts/configuration.js",
"build:ts": "tsc --build",
"build:cjs": "BABEL_ENV=cjs babel dist/ts-generated -d dist/cjs",
"build:es": "babel dist/ts-generated -d dist/es --no-babelrc",
"build:browser:before": "BABEL_ENV=browser babel dist/ts-generated -d dist/prebrowser",
"build:browser:after": "minify dist/prebrowser -d dist/browser",
"build:browser:clean": "rimraf dist/prebrowser",
"build:browser": "npm run build:browser:before && npm run build:browser:after && npm run build:browser:clean",
"build": "npm run build:clean && npm run build:ts && npm run build:browser && npm run build:cjs && npm run build:es",
"build:browser": "yarn build:browser:before && yarn build:browser:after && yarn build:browser:clean",
"build": "yarn build:clean && yarn build:ts && yarn build:browser && yarn build:cjs && yarn build:es",
"build:clean": "rimraf dist",
"pretag": "git fetch --tags",
"tag": "git tag v$npm_package_version && git push --tags origin master",
"precommit": "npm run lint",
"release:create": "hub release create -m v$npm_package_version v$npm_package_version",
"audit-ci": "audit-ci --config audit-ci.json"
"precommit": "yarn run lint",
"audit-ci": "audit-ci --config audit-ci.json",
"release": "yarn run build && yarn run changeset publish"
},
"devDependencies": {
"@babel/cli": "^7.25.6",
Expand Down Expand Up @@ -70,7 +68,6 @@
"inquirer": "^10.2.0",
"jest": "^29.7.0",
"jest-html-reporter": "^3.10.2",
"npm": "^10.8.3",
"request-debug": "^0.2.0",
"rimraf": "^6.0.1",
"shelljs": "^0.8.5",
Expand Down Expand Up @@ -151,7 +148,7 @@
},
"husky": {
"hooks": {
"pre-commit": "npm run lint"
"pre-commit": "yarn lint"
}
}
}
Loading

0 comments on commit 9783015

Please sign in to comment.