Skip to content

Publish to GitHub Packages #7

Publish to GitHub Packages

Publish to GitHub Packages #7

Workflow file for this run

name: Publish to GitHub Packages
on:
release:
types: [created]
workflow_dispatch:
jobs:
test:
uses: ./.github/workflows/browser-tests.yml
secrets: inherit
build-and-publish:
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Configure Git for private repos
run: |
git config --global user.name "bstruct"
git config --global user.email "git@bstruct.com"
git config --global url."https://${{ secrets.GIT_TOKEN }}@github.com/".insteadOf "https://github.com/"
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build WASM package
run: wasm-pack build --target web --release
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://npm.pkg.github.com'
scope: '@bstruct'
- name: Configure package for GitHub Packages
run: |
cd pkg
node -e "const pkg = require('./package.json'); pkg.name = '@bstruct/website_component_table'; pkg.publishConfig = { registry: 'https://npm.pkg.github.com' }; require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));"
- name: Publish to GitHub Packages
run: |
cd pkg
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}