Skip to content

Commit

Permalink
feat(cd): add push button release via github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
clok committed Mar 19, 2021
1 parent 24fd52b commit e0a74df
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 22 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/publish.yml

This file was deleted.

79 changes: 79 additions & 0 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Publish

on:
workflow_dispatch:
inputs:
version:
description: 'Version to pass to release.sh [vX.X.X]'
required: true

jobs:
version:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
# pull all the branches and tags
fetch-depth: 0

- uses: actions/setup-node@v2
with:
node-version: 14
registry-url: https://registry.npmjs.org/

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Install git-chglog
run: |
curl https://i.jpillora.com/git-chglog/git-chglog! | sudo bash
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies
run: npm install

- name: Setup git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: npm version
run: |
npm version ${{ github.event.inputs.version }}
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tags: true
branch: ${{ github.ref }}

- name: Create Release
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: npm publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.ORG_NPM_TOKEN }}
token: ${{ secrets.ORG_NPM_TOKEN }}
12 changes: 12 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
project_name: "@goodwaygroup/lib-hapi-rollbar"

builds:
- skip: true

changelog:
sort: desc
filters:
exclude:
- '^Merge'

0 comments on commit e0a74df

Please sign in to comment.