Skip to content

Commit

Permalink
ci(dev-canary): publish a dev NPM dist tag on every push
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Nov 24, 2021
1 parent a357e0e commit c2aea65
Showing 1 changed file with 55 additions and 1 deletion.
56 changes: 55 additions & 1 deletion .github/workflows/test-all-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
with:
path: .
key: ${{ runner.os }}-${{ matrix.node-version }}-built-${{ github.sha }}

lint:
needs: build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -80,6 +79,61 @@ jobs:
- name: lint check
run: yarn lint-check


dev-canary:
# FIXME: if: ${{github.event_name == 'push'}}
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
# note: only use one node-version
node-version: ['14.x']
steps:
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
# BEGIN-RESTORE-BOILERPLATE
- name: restore built files
id: built
uses: actions/cache@v1
with:
path: .
key: ${{ runner.os }}-${{ matrix.node-version }}-built-${{ github.sha }}
- uses: actions/checkout@v2
with:
submodules: 'true'
if: steps.built.outputs.cache-hit != 'true'
- name: yarn install
run: yarn install
if: steps.built.outputs.cache-hit != 'true'
- name: yarn build
run: yarn build
if: steps.built.outputs.cache-hit != 'true'
# END-RESTORE-BOILERPLATE

# Adapted from https://johnny.sh/notes/publish-canary-lerna-cicd/
- name: configure NPM token
run: |
echo NPM
cat ~/.npmrc || :
echo Yarn
cat ~/.yarnrc || :
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
{ test ! -f ~/.yarnrc || sed -e '/^"_authToken"/' ~/.yarnrc; } | \
{ cat; echo "\"_authToken\" \"${NPM_TOKEN}\""; } > ~/.yarnrc.tmp
mv ~/.yarnrc.tmp ~/.yarnrc
echo NPM
cat ~/.npmrc
echo Yarn
cat ~/.yarnrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: check credentials
run: npm whoami
- name: publish to NPM dev tag
run: |
yarn lerna publish prerelease --canary --exact --yes --no-push --dist-tag=dev
benchmark:
needs: build
runs-on: ubuntu-latest
Expand Down

0 comments on commit c2aea65

Please sign in to comment.