Merge pull request #33 from reside-eng/remove_deprecated_package_mana… #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
branches: | |
- main | |
- next | |
- alpha | |
- beta | |
# N.x (maintenance release branches) | |
- '[0-9]+.x' | |
concurrency: | |
group: publish-${{ github.ref }} | |
env: | |
NODE_VERSION: 18.x | |
jobs: | |
publish: | |
name: publish | |
timeout-minutes: 25 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
# TODO: Once we have dependencies, enable this for caching (requires yarn.lock) | |
# cache: yarn | |
- name: Configure package manager | |
run: | | |
echo Configuring NPM_TOKEN globally for .npmrc | |
npm config set '//registry.npmjs.org/:_authToken' ${{ env.NPM_TOKEN }} | |
npm set @reside-eng:registry "https://npm.pkg.github.com" | |
npm config set '//npm.pkg.github.com/:_authToken' $GITHUB_TOKEN | |
npm whoami | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_READ_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Semantic Release | |
uses: cycjimmy/semantic-release-action@v2 | |
id: semantic | |
with: | |
semantic_version: ^18 | |
branches: | | |
[ | |
'+([0-9])?(.{+([0-9]),x}).x', | |
'main', | |
'next', | |
'next-major', | |
{name: 'beta', prerelease: true}, | |
{name: 'alpha', prerelease: true} | |
] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push updates to branch for major version | |
# If a new version is published, i.e. v1.2.3 then this step will update | |
# branch "v1" to this commit. | |
# https://github.com/reside-eng/workflow-templates-library/branches | |
if: steps.semantic.outputs.new_release_published == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/v${{steps.semantic.outputs.new_release_major_version}} | |
notification: | |
if: always() | |
name: notification | |
needs: [publish] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- uses: technote-space/[email protected] | |
- uses: reside-eng/[email protected] | |
with: | |
current-status: ${{ env.WORKFLOW_CONCLUSION }} | |
slack-webhook: ${{ secrets.SLACK_WEBHOOK_PLATFORM_PROD }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} |