Skip to content

Commit

Permalink
👷 ci: Created package release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
joebobmiles committed Jul 13, 2021
2 parents d1bd6e7 + c6af32c commit 63ecbc5
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 4 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release

on:
push:
branches: [ master, staging ]

jobs:
release:
name: Build & Release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
persist-credentials: false

- uses: actions/setup-node@v2
with:
node-version: 15
# We must indicate the Github Package Registry, as our config packages
# are there (and also NPM). Frustratingly, NPM prefers the GPR over
# NPM - even when we indicate that we want to pull from NPM instead of
# the GPR.
registry-url: https://npm.pkg.github.com

- run: npm ci
env:
# Provide a "password" to GPR so that we can pull our packages.
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}

- run: npm run build

- run: npx semantic-release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test & Lint

on:
push:
branches-ignore: [ master, main ]
branches-ignore: [ master ]

jobs:
commitlint:
Expand All @@ -26,7 +26,7 @@ jobs:
- run: npm ci
env:
# Provide a "password" to GPR so that we can pull our packages.
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}

- run: npx commitlint --from HEAD~1 --to HEAD --verbose

Expand All @@ -49,7 +49,7 @@ jobs:
- run: npm ci
env:
# Provide a "password" to GPR so that we can pull our packages.
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}

- run: npm ci

Expand All @@ -74,6 +74,6 @@ jobs:
- run: npm ci
env:
# Provide a "password" to GPR so that we can pull our packages.
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}

- run: npm run test
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"dist"
],
"publishConfig": {
"registry": "https://registry.npmjs.org",
"access": "public"
},
"scripts": {
Expand Down Expand Up @@ -78,5 +79,21 @@
"./tsconfig.lint.json"
]
}
},
"release": {
"branches": [
"master",
{
"name": "staging",
"channel": "latest",
"prerelease": "rc"
}
],
"plugins": [
"semantic-release-config-gitmoji",
"@semantic-release/npm",
"@semantic-release/github",
"@semantic-release/git"
]
}
}

0 comments on commit 63ecbc5

Please sign in to comment.