Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix workflow for publishing to NPM #1423

Merged

Conversation

RichDom2185
Copy link
Member

  • Change the workflow trigger from PR merge to master push
  • Do not fail the workflow when GH Actions is not supposed to publish a new version; instead, just skip the publishing step after verification.

@RichDom2185 RichDom2185 self-assigned this May 25, 2023
@coveralls
Copy link

coveralls commented May 25, 2023

Pull Request Test Coverage Report for Build 5711452271

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 82.889%

Totals Coverage Status
Change from base Build 5711447058: 0.0%
Covered Lines: 10736
Relevant Lines: 12526

💛 - Coveralls

@shenyih0ng
Copy link
Member

shenyih0ng commented May 27, 2023

found this workflow that we can use: https://github.com/JS-DevTools/npm-publish, it seems to do what we want

Example workflow (publish package + tag commit):

name: Publish to npm

on:
  push:
    branches: main

jobs:
  publish:
    runs-on: ubuntu-latest
    environment: publish-npm # Await approval from maintainers
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: "16"

      - name: Publish to NPM
        uses: JS-DevTools/npm-publish@v2
        with:
          token: ${{ secrets.NPM_TOKEN }}
          dry-run: true # = npm publish --dry-run

      - name: Tag Release  # tag commit with new version (corresponds to npm version) 
        run: |
          git tag ${{ steps.publish.outputs.version }}
          git push origin ${{github.run_id}}

@martin-henz
Copy link
Member

OK, let's try this.

@martin-henz martin-henz merged commit 4b9e97a into source-academy:master Jul 31, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants