Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
Change cicd to match other packages for simple releases.
Browse files Browse the repository at this point in the history
  • Loading branch information
Codex- committed Apr 4, 2022
1 parent 1f56736 commit fb4bc4c
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 46 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: build
on:
push:

jobs:
build:
timeout-minutes: 15
env:
CI: true
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Use NPM 8
run: npm i -g npm@8
- run: npm ci
- name: build
run: npm run build
- name: test
id: test
if: ${{ always() }}
run: npm run test
- name: lint
if: ${{ always() }}
run: npm run lint
- name: style
if: ${{ always() }}
run: npm run format:check

codecov: # Send only a single coverage report per run
needs: build
timeout-minutes: 15
env:
CI: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js lts
uses: actions/setup-node@v2
with:
node-version: lts/*
cache: npm
- run: npm ci
- name: test
run: npm run test -- --coverage
- name: codecov
uses: codecov/codecov-action@v2
40 changes: 0 additions & 40 deletions .github/workflows/nodejs.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: release
on:
workflow_dispatch:
inputs:
version:
type: choice
description: Version number to increment
required: true
options:
- patch
- minor
- major

jobs:
release:
env:
CI: true
GITHUB_TOKEN: ${{ secrets.ACTION_GITHUB_TOKEN }}
NPM_OTP_TOKEN: ${{ github.event.inputs.otp }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Need history for changelog generation
- name: Use Node.js lts
uses: actions/setup-node@v2
with:
node-version: lts/*
registry-url: https://registry.npmjs.org
- run: npm ci
- name: build
run: npm run build
- name: test
id: test
if: ${{ always() }}
run: npm run test -- --coverage
- name: lint
if: ${{ always() }}
run: npm run lint
- name: style
if: ${{ always() }}
run: npm run format:check
- name: npm auth
run: npm set "//registry.npmjs.org/:_authToken" ${{ env.NPM_TOKEN }}
- name: config git user
run: |
git config --global user.name ${{ secrets.ACTION_GITHUB_USERNAME }};
git config --global user.email ${{ secrets.ACTION_GITHUB_EMAIL }};
- name: perform release
run: |
npm run release -- \
${{ github.event.inputs.version }} \
--ci
- name: codecov # Perform after version publishing
if: steps.test.outcome == 'success'
uses: codecov/codecov-action@v2
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# metro-info

[![Build Status](https://img.shields.io/github/workflow/status/Codex-/metro-info/Node%20CI.svg?style=flat-square)](https://github.com/Codex-/metro-info/actions?workflow=Node+CI)
[![Code Coverage Status](https://img.shields.io/coveralls/github/Codex-/metro-info.svg?style=flat-square)](https://coveralls.io/github/Codex-/metro-info)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![build](https://github.com/Codex-/metro-info/actions/workflows/build.yml/badge.svg)](https://github.com/Codex-/metro-info/actions/workflows/build.yml)
[![codecov](https://codecov.io/gh/Codex-/metro-info/branch/main/graph/badge.svg?token=WWGNIPC249)](https://codecov.io/gh/Codex-/metro-info)
[![npm](https://img.shields.io/npm/v/metro-info.svg)](https://www.npmjs.com/package/metro-info)

> 🚌 Simplified interaction with Christchurch's Metro Info bus service
## Install

```
```shell
npm install metro-info
```

Expand All @@ -17,7 +17,7 @@ npm install metro-info
Getting times for a specific Platform can be achieved as per the example below.

```typescript
import { getPlatformTimes, PlatformTimes } from 'metro-info';
import { getPlatformTimes, PlatformTimes } from "metro-info";

async function getTimes(): void {
const platformTimes: PlatformTimes = await getPlatformTimes(1205);
Expand All @@ -27,7 +27,7 @@ async function getTimes(): void {
If you're unsure of a Platform number, they can be found on the physical stops themselves or alternatively a complete collection of all Platforms with their locations, tags, and various other information can be obtained as per the example below.

```typescript
import { getPlatformLocations, PlatformLocations } from 'metro-info';
import { getPlatformLocations, PlatformLocations } from "metro-info";

async function getLocations(): void {
const platformLocations: PlatformLocations = await getPlatformLocations();
Expand Down

0 comments on commit fb4bc4c

Please sign in to comment.