diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..3dc13be0a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,28 @@ +on: + push: + branches: + - main + - next + +jobs: + test: + uses: ./.github/workflows/test.yml + + publish-npm: + name: '๐Ÿ“ฆ Build and Publish ๐Ÿš€' + needs: [test] + runs-on: ubuntu-latest + environment: production + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + registry-url: https://registry.npmjs.org/ + cache: yarn + - name: โš™ bootstrap + run: 'npm run bootstrap && git fetch --tags' + - name: ๐Ÿ“ฆ build and publish ๐Ÿš€ + run: npx _release + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 3297fcbb8..bf05e68af 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,9 +1,7 @@ -name: Workflow - on: - push: pull_request: workflow_dispatch: + workflow_call: jobs: test: @@ -20,22 +18,3 @@ jobs: run: npx _lint - name: ๐Ÿงช tests run: npm test - - publish-npm: - name: '๐Ÿ“ฆ Build and Publish ๐Ÿš€' - if: ${{ github.repository == 'taye/interact.js' && (github.ref_name == 'latest' || github.ref_name == 'next') }} - needs: test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v4 - with: - node-version: 16 - registry-url: https://registry.npmjs.org/ - cache: yarn - - name: โš™ bootstrap - run: 'npm run bootstrap && git fetch --tags' - - name: ๐Ÿ“ฆ build and publish ๐Ÿš€ - run: npx _release - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}}