Skip to content

Commit

Permalink
Build: add GitHub Actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonmleigh committed Oct 4, 2024
1 parent 028f241 commit c5943aa
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 7 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build and Test
on:
pull_request:

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest

steps:
- name: Git Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
registry-url: "https://registry.npmjs.org"

- name: NPM install
run: npm ci

- name: Test
run: npm run test

- name: Compile
run: npm run compile

- name: Lint
run: npm run lint
51 changes: 51 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release
on:
push:
branches:
- main

permissions:
contents: write
issues: write
pull-requests: write

jobs:
build:
name: Release
runs-on: ubuntu-latest

steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
registry-url: "https://registry.npmjs.org"

- name: NPM install
run: npm ci

- name: Test
run: npm run test

- name: Compile
run: npm run compile

- name: Lint
run: npm run lint

- name: Configure Git
shell: bash
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
- name: Release
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zip24",
"version": "0.1.0",
"version": "0.1.2",
"description": "A zip package for the modern age",
"type": "module",
"author": "Gordon Leigh",
Expand Down Expand Up @@ -112,11 +112,11 @@
"compile": "tsc",
"coverage": "c8 --src src/ --all -r text -r lcovonly node --import=@swc-node/register/esm-register --test-reporter=dot --test 'src/**/*.test.ts'",
"lint": "eslint src",
"test": "c8 --100 --src src/ --all -r text -r lcovonly node --import @swc-node/register/esm-register --enable-source-maps --test 'src/**/*.test.*'",
"release": "release-it -VV",
"test": "c8 --100 --src src/ --all -r text -r lcovonly node --import @swc-node/register/esm-register --test-reporter=spec --enable-source-maps --test 'src/**/*.test.*'",
"watch:compile": "tsc -w",
"watch:coverage": "nodemon -e ts,js --watch src --exec npm run coverage",
"watch:test": "node --import @swc-node/register/esm-register --enable-source-maps --watch --test 'src/**/*.test.*'",
"release": "release-it"
"watch:test": "node --import @swc-node/register/esm-register --enable-source-maps --watch --test 'src/**/*.test.*'"
},
"dependencies": {
"crc-32": "^1.2.2"
Expand All @@ -143,16 +143,17 @@
"release-it": {
"$schema": "https://unpkg.com/release-it/schema/release-it.json",
"git": {
"requiredBranch": "main"
"requireCommits": true,
"requireBranch": "main"
},
"github": {
"release": true
},
"hooks": {
"commitMessage": "chore: release v${version}"
"commitMessage": "Chore: release v${version}"
},
"npm": {
"publish": true
"publish": false
},
"plugins": {
"@release-it/conventional-changelog": {
Expand Down

0 comments on commit c5943aa

Please sign in to comment.