Skip to content

Workflow file for this run

name: Publish package to Npmjs and notify on Mattermost
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
env:
DEPLOYMENT_URL: https://www.npmjs.com/package/@dataesr/dsfr-plus
MM_NOTIFICATION_CHANNEL: bots
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
scope: "@dataesr"
- run: npm ci
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
release:
name: Create new Github release
runs-on: ubuntu-latest
needs: publish
steps:
- name: 🏁 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🏷️ Get tag
id: tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create changelog text
id: changelog
uses: loopwerk/tag-changelog@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
config_file: .github/config/changelog.cjs
- name: 📦 Create release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.tag.outputs.tag }}
body: ${{ steps.changelog.outputs.changes }}
notify:
needs:
- publish
- release
if: always()
runs-on: ubuntu-latest
steps:
- uses: dataesr/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN}}
mattermost_webhook_url: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
mattermost_channel: ${{ env.MM_NOTIFICATION_CHANNEL}}
deployment_url: ${{ env.DEPLOYMENT_URL }}