Skip to content

Add .js (and organize) imports and exports (#1027) #1

Add .js (and organize) imports and exports (#1027)

Add .js (and organize) imports and exports (#1027) #1

name: Publish compute-baseline@next
on:
push:
branches:
- "main"
paths:
- packages/compute-baseline/**
env:
package: "compute-baseline"
package_dir: "packages/compute-baseline"
dist_tag: "next"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .node-version
cache: npm
- run: npm ci
- run: npm test
publish:
if: github.repository == 'web-platform-dx/web-features'
runs-on: ubuntu-latest
needs: "test"
steps:
- name: Get timestamp
id: timestamp
run: echo "TIMESTAMP=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .node-version
cache: npm
registry-url: "https://registry.npmjs.org"
- run: npm ci
- name: Get package.json version
id: version
run: echo "VERSION=$(npm version --json --workspace=${{ env.package }} | jq --raw-output '.["${{ env.package }}"]')" >> $GITHUB_OUTPUT
- run: npm version --workspace=${{ env.package }} --no-git-tag-version "$VERSION-dev-$TIMESTAMP-$(git rev-parse --short HEAD)"
# The version string template is: <package.json version>-dev-<timestamp>-<commit-hash>
# Why not use SemVer build metadata with a plus sign for some of this?
# Because npm completely ignores it. 😒
env:
VERSION: ${{ steps.version.outputs.VERSION }}
TIMESTAMP: ${{ steps.timestamp.outputs.TIMESTAMP }}
- run: npm publish --workspace=${{ env.package }} --tag ${{ env.dist_tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}