Skip to content

Add newline to EOF

Add newline to EOF #1

Workflow file for this run

name: Publish Dev
on:
push:
branches-ignore:
# Hopefully used for github pages deployments in future
- gh-pages
# Personal branch to create PRs from
- jley-*
jobs:
# This workflow triggers on push, so there is no simple concept of "diff"
# So no need to pass base/head refs (will _always_ trigger internal lint/test)
build-and-test:
uses: ./.github/workflows/build-and-test.yaml
publish-dev:
needs: build-and-test
runs-on: ubuntu-latest
strategy:
matrix:
package:
- name: default-import
safe-name: default-import
path: tools/default-import
- name: enum-to-array
safe-name: enum-to-array
path: tools/enum-to-array
- name: iso-crypto
safe-name: iso-crypto
path: tools/iso-crypto
- name: named-patch
safe-name: named-patch
path: tools/named-patch
- name: normalized-react-query
safe-name: normalized-react-query
path: tools/normalized-react-query
- name: parse-cwd
safe-name: parse-cwd
path: tools/parse-cwd
- name: punycode-esm
safe-name: punycode-esm
path: tools/punycode-esm
- name: static-emitter
safe-name: static-emitter
path: tools/static-emitter
- name: entry-script
safe-name: entry-script
path: tools/entry-script
- name: find-import
safe-name: find-import
path: tools/find-import
- name: juniper
safe-name: juniper
path: apps/juniper
- name: barrelify
safe-name: barrelify
path: apps/barrelify
- name: root-package-json
safe-name: root-package-json
path: tools/root-package-json
- name: packages-list
safe-name: packages-list
path: tools/packages-list
- name: dependency-order
safe-name: dependency-order
path: tools/dependency-order
- name: rivendell
safe-name: rivendell
path: apps/rivendell
steps:
- uses: actions/checkout@v3
# Artifact includes node_modules + all built packages
- uses: actions/download-artifact@v3
with:
name: build
- uses: actions/setup-node@v3
with:
node-version: 16
- run: |
for TARBALL in ./tarballs/*.tgz
do
tar -xf $TARBALL
done
# Authorize NPM + download jq (CLI for JSON parsing + manipulation)
- run: |
echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }} >> ~/.npmrc
sudo apt-get install jq
# Update `file://...` "versions" for local dependencies, then publish
- working-directory: ${{ matrix.package.path }}
run: |
# Get raw version (without dev suffix)
VERSION=`cat ./package.json | jq '.version' -r`
# Add dev suffix (based on hash) to all relevant packages
node ${{ github.workspace }}/common/scripts/install-run-rush.js set-dev-version --project ${{ matrix.package.name }}
# Read dev suffix, and check if version already exists
DEV_VERSION=`cat ./package.json | jq '.version' -r`
EXISTS=`${{ github.workspace }}/common/scripts/package-exists.mjs ${{ matrix.package.name }} $DEV_VERSION`
if [[ $EXISTS == true ]]
then
# If version already exists, publish is NOOP at best (fails at worst) so quit early
exit 0
fi
# Tack on generic License + npmignore
node ${{ github.workspace }}/common/scripts/install-run-rush.js write-publish
# Non-main branches should still publish, but never as "dev". "ignore" tag will be cleaned up.
if [[ ${{ github.ref_name }} == main ]]
then
TAG=dev
else
TAG=ignore
fi
# First publish with git sha (this version will be re-published if released, easiest to lookup in github action)
npm pkg set version=$VERSION-dev.${{ github.sha }}
${{ github.workspace }}/common/temp/pnpm-local/node_modules/.bin/pnpm publish --no-git-checks --tag ignore
# Reset version to hash
npm pkg set version=$DEV_VERSION
# Indicate "paired" package for easy lookup
npm pkg set gitsha=${{ github.sha }}
# Publish with hash
${{ github.workspace }}/common/temp/pnpm-local/node_modules/.bin/pnpm publish --no-git-checks --tag $TAG
# Cleanup "ignore" tag
${{ github.workspace }}/common/temp/pnpm-local/node_modules/.bin/pnpm dist-tag rm ${{ matrix.package.name }} ignore