Skip to content

Commit

Permalink
add pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
t83714 committed Dec 21, 2023
1 parent 05cb3c9 commit f70ff77
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 35 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Main CI Workflow

on: push

jobs:
build-test:
name: Build, Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18

- run: yarn install
- run: yarn test
30 changes: 30 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
release:
types: [published]

env:
REPO_NAME: magda-auth-oidc

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

- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18

- run: yarn install
- run: yarn build
- run: yarn test

- name: publish NPM package
run: |
npm config set @magda:registry https://registry.npmjs.org/
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
npm publish --access public
45 changes: 45 additions & 0 deletions .github/workflows/set-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: set-version

run-name: Set version ${{ inputs.version }} on ${{ github.ref_name }}

on:
workflow_dispatch:
inputs:
version:
description: "Please input the new version number. e.g. `v2.0.0-alpha.0` with leading `v`"
required: true
type: string

jobs:
log-the-inputs:
runs-on: ubuntu-latest
steps:
- name: Version validation
env:
SELECTED_VERSION: ${{ inputs.version }}
run: |
SEMVER_REGEX="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
[[ "${SELECTED_VERSION}" =~ $SEMVER_REGEX ]] || { echo "Invalid version number '$SELECTED_VERSION'. Should be e.g. 'v2.0.0-alpha.0' with leading 'v'." ; exit 1; }
- uses: actions/checkout@v3

- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install Utilities
run: yarn install

- name: Setup Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Set version
env:
SELECTED_VERSION: ${{ inputs.version }}
run: |
VERSION_NUM=$(echo ${SELECTED_VERSION} | cut -b 2-)
yarn version --new-version ${VERSION_NUM}
git push
73 changes: 38 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
{
"name": "@magda/tsmonad",
"version": "0.9.0",
"description": "TsMonad - fun-size monads library for TypeScript",
"type": "module",
"typings": "./dist/index.d.ts",
"directories": {},
"scripts": {
"clean": "rm -rf dist",
"build": "yarn clean && tsc -b",
"pretest": "yarn build",
"test": "mocha dist/test"
},
"repository": {
"type": "git",
"url": "https://github.com/magda-io/TsMonad.git"
},
"keywords": [
"typescript",
"monad",
"functional"
],
"author": {
"name": "Chris Bowdon",
"url": "https://github.com/cbowdon"
},
"license": "MIT",
"devDependencies": {
"@types/mocha": "^10.0.6",
"@types/node": "^18.11.9",
"@types/underscore": "^1.8.0",
"assert": "^2.1.0",
"mocha": "^10.2.0",
"typescript": "5.3.3",
"underscore": "^1.13.6"
}
"name": "@magda/tsmonad",
"version": "0.9.0",
"description": "TsMonad - fun-size monads library for TypeScript",
"type": "module",
"exports": {
"import": "./dist/index.js"
},
"typings": "./dist/index.d.ts",
"directories": {},
"scripts": {
"clean": "rm -rf dist",
"build": "yarn clean && tsc -b",
"pretest": "yarn build",
"test": "mocha dist/test"
},
"repository": {
"type": "git",
"url": "https://github.com/magda-io/TsMonad.git"
},
"keywords": [
"typescript",
"monad",
"functional"
],
"author": {
"name": "Chris Bowdon",
"url": "https://github.com/cbowdon"
},
"license": "MIT",
"devDependencies": {
"@types/mocha": "^10.0.6",
"@types/node": "^18.11.9",
"@types/underscore": "^1.8.0",
"assert": "^2.1.0",
"mocha": "^10.2.0",
"typescript": "5.3.3",
"underscore": "^1.13.6"
}
}

0 comments on commit f70ff77

Please sign in to comment.