From eab0ed33b3812884caa428cb03cf96d8405d598e Mon Sep 17 00:00:00 2001 From: Palash Mondal Date: Fri, 3 May 2024 10:42:23 +0530 Subject: [PATCH] chore: add workflow updates --- .github/workflows/auto-approve.yml | 9 ------- .github/workflows/gh-release.yml | 20 +++++++++++++++ .github/workflows/npm-publish.yml | 40 +++++++----------------------- 3 files changed, 29 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/auto-approve.yml create mode 100644 .github/workflows/gh-release.yml diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml deleted file mode 100644 index 557bce6..0000000 --- a/.github/workflows/auto-approve.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: Auto-approve PR -on: pull_request_target -permissions: - pull-requests: write -jobs: - apply: - if: github.actor == 'renovate[bot]' - uses: palashmon/reusable-workflows/.github/workflows/auto-approve.yml@main - secrets: inherit \ No newline at end of file diff --git a/.github/workflows/gh-release.yml b/.github/workflows/gh-release.yml new file mode 100644 index 0000000..37790f8 --- /dev/null +++ b/.github/workflows/gh-release.yml @@ -0,0 +1,20 @@ +name: GitHub Release + +on: + schedule: + - cron: '30 2 * * 5' # Weekly + workflow_dispatch: # manual trigger + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: write + packages: write + pull-requests: write + +jobs: + call-workflow: + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + uses: palashmon/reusable-workflows/.github/workflows/gh-release.yml@main diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 6893f6d..ee0f818 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,34 +1,12 @@ -# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created -# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages - -name: Publish Package to Npmjs - +name: Publish NPM Release on: - release: - types: [published] - + workflow_run: + workflows: ["GitHub Release"] + types: [completed] jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 - with: - node-version: "20.x" - - run: npm i - - run: npm test - - publish-npm: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 - with: - node-version: "20.x" - registry-url: "https://registry.npmjs.org" - - run: npm i - - run: npm run build - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + if: ${{ github.event.workflow_run.conclusion == 'success' }} + uses: palashmon/reusable-workflows/.github/workflows/npm-publish.yml@main + secrets: inherit + with: + build-needed: true