From afc49ea949d72f65b574663fc9f8b8e0ddd01d12 Mon Sep 17 00:00:00 2001 From: Giles Roadnight Date: Fri, 20 May 2022 10:20:42 +0000 Subject: [PATCH] Update release process --- .github/workflows/create-release.yaml | 42 +++++++++++++++++++++++++++ .github/workflows/release.yml | 25 ---------------- 2 files changed, 42 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/create-release.yaml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml new file mode 100644 index 0000000..1fe60dd --- /dev/null +++ b/.github/workflows/create-release.yaml @@ -0,0 +1,42 @@ +name: Create Release + +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '16.x' + + - name: Install node modules and verify build + run: npm ci && npm run build-release + + - name: Release + if: github.repository == 'morganstanley/needle' + uses: justincy/github-action-npm-release@2.0.2 + id: release + with: + token: ${{ secrets.RELEASE_TOKEN }} + + - name: Print release output + if: ${{ steps.release.outputs.released == 'true' }} + run: echo Release ID ${{ steps.release.outputs.release_id }} + + - name: Publish + if: steps.release.outputs.released == 'true' + uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 2baa6ca..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: NPM Publish -on: - release: - types: [published] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - # Setup .npmrc file to publish to npm - - uses: actions/setup-node@v2 - with: - node-version: '14.x' - registry-url: 'https://registry.npmjs.org' - - run: npm ci - - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - uses: JamesIves/github-pages-deploy-action@4.1.5 - with: - branch: gh-pages - folder: docs - - uses: codecov/codecov-action@v2 - with: - token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file