Release NPM Packages #161
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: Release NPM Packages | |
on: | |
workflow_dispatch: | |
# schedule: | |
# - cron: '0 7 * * 0-4' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_SERVICE_USER: "Microsoft FAST Builds" | |
GITHUB_SERVICE_EMAIL: "[email protected]" | |
jobs: | |
build_linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [20.x] | |
if: contains('chrisdholt,janechu,nicholasrice,awentzel,eisenbergeffect', github.actor) | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Set Git User | |
run: | | |
git config --global user.name "${{ env.GITHUB_SERVICE_USER }}" | |
git config --global user.email "${{ env.GITHUB_SERVICE_EMAIL }}" | |
- name: Cache multiple paths | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
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 package dependencies / prepare workspaces | |
run: npm ci | |
- name: Check for the presence of changed files inside ./change | |
run: npm run checkchange | |
- name: Testing Prettier format | |
run: npm run prettier:diff | |
- name: Testing unit tests | |
run: npm run test --stream | |
- name: Publish NPM packages | |
env: | |
NPM_SECRET_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm run publish-ci -n $NPM_SECRET_TOKEN | |
notify: | |
runs-on: ubuntu-latest | |
needs: build_linux | |
steps: | |
- name: Notify on Discord | |
uses: appleboy/discord-action@master | |
with: | |
webhook_id: ${{ secrets.DISCORD_NOTIFICATION_WEBHOOK_ID }} | |
webhook_token: ${{ secrets.DISCORD_NOTIFICATION_WEBHOOK_TOKEN }} | |
color: '#DE2D6D' | |
username: 'FAST DevOps Packages Bot' | |
message: 'Release has published to NPM on https://github.com/microsoft/fast/actions/workflows/cd-release-npm.yml' |