pack and publish node-medley #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pack and publish node-medley | |
on: | |
workflow_run: | |
workflows: | |
- node-medley native module | |
types: | |
- completed | |
env: | |
NODE_MEDLEY_DIR: ./packages/node-medley | |
PREBUILDS_DIR: ./packages/node-medley/prebuilds | |
HUSKY: 0 | |
jobs: | |
pack-and-publish: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
architecture: x64 | |
registry-url: https://registry.npmjs.org | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9.12.2 | |
- name: Make sure pnpm fetch Node | |
shell: bash | |
run: | | |
pnpm &>/dev/null || true | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
# if: ${{ !github.event.act }} | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
# if: ${{ !github.event.act }} | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-native-build | |
restore-keys: | | |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-native-build | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Download | |
id: download | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
run_id: ${{ github.event.workflow_run.id }} | |
name_is_regexp: true | |
name: ^(win32|linux|darwin)-(x64|arm64)$ | |
path: ${{ env.PREBUILDS_DIR }} | |
skip_unpack: true | |
- name: Unzip | |
working-directory: ${{ env.PREBUILDS_DIR }} | |
run: | | |
find . -name "*.zip" -exec unzip -o {} \; | |
rm -rf *.zip | |
- name: Package | |
working-directory: ${{ env.NODE_MEDLEY_DIR }} | |
run: | | |
pnpm install --no-frozen-lockfile --ignore-scripts | |
pnpm run build:js | |
pnpm run package | |
- name: Check Tag | |
id: check-tag | |
working-directory: ${{ env.NODE_MEDLEY_DIR }} | |
run: | | |
if grep MEDLEY_VERSION_PRE_RELEASE src/version.h >/dev/null; then | |
echo "TAG=pre" >> "$GITHUB_OUTPUT" | |
else | |
echo "TAG=latest" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Publish | |
working-directory: ${{ env.NODE_MEDLEY_DIR }} | |
run: | | |
pnpm publish ./dist --no-git-checks --tag ${{ steps.check-tag.outputs.TAG }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |