Skip to content

Commit

Permalink
Merge pull request #6 from byu-oit/updates
Browse files Browse the repository at this point in the history
Added automatic github releases
  • Loading branch information
yoshutch authored Apr 9, 2021
2 parents 0a8e2d0 + d5b5d0e commit 5e9080c
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: 2

updates:
# API Node Modules
# Node Modules
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
target-branch: "main" # Our dev pipeline runs off the dev branch, production runs off of master
target-branch: "main"
# Requesting reviews from yourself makes Dependabot PRs easy to find (https://github.com/pulls/review-requested)
reviewers:
- "yoshutch"
Expand All @@ -16,7 +16,7 @@ updates:
directory: "/" # For GitHub Actions, set the directory to / to check for workflow files in .github/workflows. (GitHub Docs)
schedule:
interval: "daily"
target-branch: "main" # Our dev pipeline runs off the dev branch, production runs off of master
target-branch: "main"
# Requesting reviews from yourself makes Dependabot PRs easy to find (https://github.com/pulls/review-requested)
reviewers:
- "yoshutch"
48 changes: 48 additions & 0 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Weekly Bump Dependencies
on:
schedule:
- cron: '0 14 * * 1'
workflow_dispatch:
env:
node_version: "14.x"

jobs:
Bump:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}

- name: npm install
run: npm install

- name: Check outdated dependencies
id: outdated
run: npm outdated || echo ::set-output name=outdated::1

- name: Bump dependencies
if: steps.outdated.outputs.outdated == 1
run: npm update

- name: Bump patch version
if: steps.outdated.outputs.outdated == 1
run: npm version patch -git-tag-version=false

- name: Create (or update) pull request
if: steps.outdated.outputs.outdated == 1
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GH_ACTIONS_TOKEN }} # Use non-default token so that this PR will trigger CI
title: 'chore(deps): bump dependencies'
commit-message: 'chore(deps): bump dependencies'
body: Created using the [Weekly Bump Dependenciesv](https://github.com/${{ github.repository }}/actions?query=workflow%3A%22Weekly+Bump+Dependencies%22) workflow
branch: bump-dependencies
labels: |
dependencies
javascript
reviewers: yoshutch
33 changes: 31 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
fail-fast: false
steps:
- uses: actions/checkout@v2

Expand All @@ -30,8 +31,12 @@ jobs:
run: npm install

- name: npm test
run: |
npm run coverage
if: ${{ matrix.node-version != env.node_version }} # just run the tests if not node 14
run: npm run test

- name: npm test with coverage
if: ${{ matrix.node-version == env.node_version }} # only upload coverage from node 14
run: npm run coverage

- name: Upload coverage to Codecov
if: ${{ matrix.node-version == env.node_version }} # only upload coverage from node 14
Expand Down Expand Up @@ -70,3 +75,27 @@ jobs:

- name: npm lint
run: npm run lint

# https://github.com/marketplace/actions/release-drafter
draft_release:
name: Draft Release
runs-on: ubuntu-latest
needs: [test, audit, lint]
steps:
- uses: actions/checkout@v2

- id: version
run: echo ::set-output name=version::$(node -p 'require("./package.json").version')

- name: Draft release
id: draft
uses: release-drafter/release-drafter@v5
with:
version: ${{ steps.version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Link to Release
run: |
echo "Release draft create/updated: ${{ steps.draft.outputs.html_url }}"
# ENH: maybe look into adding a comment to the PR with a link to the release draft?
23 changes: 21 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Deployment

on:
push:
branches: [ignore] # TODO remove
branches: [main]

env:
node_version: "14"
node_version: "14.x"

jobs:
env:
Expand Down Expand Up @@ -117,3 +117,22 @@ jobs:
run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets[matrix.registry.token] }}

# https://github.com/marketplace/actions/release-drafter
release:
name: Publish Release
runs-on: ubuntu-latest
needs: [publish]
steps:
- uses: actions/checkout@v2

- id: version
run: echo ::set-output name=version::$(node -p 'require("./package.json").version')

- name: Publish Release
uses: release-drafter/release-drafter@v5
with:
publish: true
version: ${{ steps.version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# BYU Logger
[![GitHub Release](https://img.shields.io/github/release/byu-oit/logger?style=flat)]()
[![codecov](https://codecov.io/gh/byu-oit/logger/branch/main/graph/badge.svg?token=6kkkOs7yEe)](https://codecov.io/gh/byu-oit/express-logger)

Creates a [`pino` logger](https://github.com/pinojs/pino) with default settings to match the [BYU Application Development logging standards](https://github.com/byu-oit/app-dev-best-practices/blob/main/adr/application/0006-basic-logging-standards.md).

Expand Down
24 changes: 17 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@byu-oit/logger",
"version": "0.2.0",
"version": "0.2.1",
"description": "Default configuration for pino logger",
"contributors": [
"Scott Hutchings <[email protected]>"
Expand Down Expand Up @@ -34,7 +34,7 @@
"snazzy": "^9.0.0",
"ts-jest": "^26.5.4",
"ts-standard": "^10.0.0",
"typescript": "^4.2.3"
"typescript": "^4.2.4"
},
"engines": {
"node": ">=10"
Expand Down

0 comments on commit 5e9080c

Please sign in to comment.