Skip to content

Commit e0a74df

Browse files
committed
feat(cd): add push button release via github actions
1 parent 24fd52b commit e0a74df

File tree

3 files changed

+91
-22
lines changed

3 files changed

+91
-22
lines changed

.github/workflows/publish.yml

-22
This file was deleted.

.github/workflows/version.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to pass to release.sh [vX.X.X]'
8+
required: true
9+
10+
jobs:
11+
version:
12+
runs-on: ubuntu-20.04
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
with:
17+
# pull all the branches and tags
18+
fetch-depth: 0
19+
20+
- uses: actions/setup-node@v2
21+
with:
22+
node-version: 14
23+
registry-url: https://registry.npmjs.org/
24+
25+
- name: Set up Go
26+
uses: actions/setup-go@v2
27+
with:
28+
go-version: 1.16
29+
30+
- name: Install git-chglog
31+
run: |
32+
curl https://i.jpillora.com/git-chglog/git-chglog! | sudo bash
33+
34+
- name: Cache node modules
35+
uses: actions/cache@v2
36+
env:
37+
cache-name: cache-node-modules
38+
with:
39+
# npm cache files are stored in `~/.npm` on Linux/macOS
40+
path: ~/.npm
41+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
42+
restore-keys: |
43+
${{ runner.os }}-build-${{ env.cache-name }}-
44+
${{ runner.os }}-build-
45+
${{ runner.os }}-
46+
47+
- name: Install Dependencies
48+
run: npm install
49+
50+
- name: Setup git user
51+
run: |
52+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
53+
git config --local user.name "github-actions[bot]"
54+
55+
- name: npm version
56+
run: |
57+
npm version ${{ github.event.inputs.version }}
58+
59+
- name: Push changes
60+
uses: ad-m/[email protected]
61+
with:
62+
github_token: ${{ secrets.GITHUB_TOKEN }}
63+
tags: true
64+
branch: ${{ github.ref }}
65+
66+
- name: Create Release
67+
uses: goreleaser/goreleaser-action@v2
68+
with:
69+
version: latest
70+
args: release --rm-dist
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: npm publish
75+
run: npm publish --access public
76+
env:
77+
NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }}
78+
NPM_TOKEN: ${{ secrets.ORG_NPM_TOKEN }}
79+
token: ${{ secrets.ORG_NPM_TOKEN }}

.goreleaser.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This is an example .goreleaser.yml file with some sane defaults.
2+
# Make sure to check the documentation at http://goreleaser.com
3+
project_name: "@goodwaygroup/lib-hapi-rollbar"
4+
5+
builds:
6+
- skip: true
7+
8+
changelog:
9+
sort: desc
10+
filters:
11+
exclude:
12+
- '^Merge'

0 commit comments

Comments
 (0)