diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bd18d07 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8965cec..166506f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Test & Lint on: push: - branches-ignore: [ master, main ] + branches-ignore: [ master ] jobs: commitlint: @@ -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 @@ -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 @@ -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 \ No newline at end of file diff --git a/package.json b/package.json index dffa9d5..01aca25 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "dist" ], "publishConfig": { + "registry": "https://registry.npmjs.org", "access": "public" }, "scripts": { @@ -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" + ] } }