Skip to content

Automatically publish npm pack to GH Releases #40

Automatically publish npm pack to GH Releases

Automatically publish npm pack to GH Releases #40

Workflow file for this run

on:
push:
branches:
- main
pull_request:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- run: npm ci
- run: npm run build
- run: npm test
- run: npm run lint
package-test:
runs-on: ubuntu-latest
if: github.head_ref == 'refs/heads/justin/publish-packs'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- run: npm ci
- run: npm pack
- name: Upload package to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload 0.1.0 ./*.tgz
package:
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs: build
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- run: npm ci
- run: npm pack
- name: Upload package to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} ./*.tgz