From 1937b421e953ee06e31880435c2b3ecf4053cbbc Mon Sep 17 00:00:00 2001 From: folland87 Date: Thu, 15 Feb 2024 15:47:15 +0100 Subject: [PATCH] fix(workflow): add a workflow on main --- .github/workflows/main.yml | 23 +++------------------- .github/workflows/tags.yml | 40 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/tags.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1679edc..1bfd102 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,11 +2,11 @@ name: Publish package to Npmjs and notify on Mattermost on: push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+" + branch: + - main env: - DEPLOYMENT_URL: https://www.npmjs.com/package/@dataesr/dsfr-plus + DEPLOYMENT_URL: https://dataesr.github.io/dsfr-plus/ MM_NOTIFICATION_CHANNEL: bots permissions: @@ -20,22 +20,6 @@ concurrency: cancel-in-progress: true 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 }} - deploy-examples: environment: name: github-pages @@ -65,7 +49,6 @@ jobs: notify: needs: - - publish - deploy-examples if: always() runs-on: ubuntu-latest diff --git a/.github/workflows/tags.yml b/.github/workflows/tags.yml new file mode 100644 index 0000000..08d4a81 --- /dev/null +++ b/.github/workflows/tags.yml @@ -0,0 +1,40 @@ +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 }} + + notify: + needs: + - publish + if: always() + runs-on: ubuntu-latest + steps: + - uses: dataesr/mm-notifier-action@v1.0.2 + with: + github_token: ${{ secrets.GITHUB_TOKEN}} + mattermost_webhook_url: ${{ secrets.MATTERMOST_WEBHOOK_URL }} + mattermost_channel: ${{ env.MM_NOTIFICATION_CHANNEL}} + deployment_url: ${{ env.DEPLOYMENT_URL }} \ No newline at end of file