Publish Dev #81
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: Publish Dev | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
jobs: | |
npm-publish: | |
name: npm publish | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- package: "pelican.js" | |
folder: "pelican.js" | |
- package: "@pelicanjs/application" | |
folder: "application" | |
- package: "@pelicanjs/client" | |
folder: "client" | |
- package: "@pelicanjs/types" | |
folder: "types" | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
if: github.repository_owner == 'hexaaagon' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Node.js v20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- name: Check the current development version | |
id: release-check | |
run: | | |
if [[ $(npm view ${{ matrix.package }}@develop version | grep -e "$(git rev-parse --short HEAD)") ]]; \ | |
then echo "RELEASE=0" >> "$GITHUB_OUTPUT"; \ | |
else echo "RELEASE=1" >> "$GITHUB_OUTPUT"; \ | |
fi | |
- name: Install dependencies | |
if: steps.release-check.outputs.release == '1' | |
uses: ./.github/actions/pnpmCache | |
- name: Build dependencies | |
if: steps.release-check.outputs.release == '1' | |
run: pnpm run build | |
- name: Publish package | |
if: steps.release-check.outputs.release == '1' | |
run: | | |
VERSION=$(node -p "require('./packages/${{ matrix.folder }}/package.json').version") | |
TIMESTAMP=$(date +%s) | |
DEVELOP_VERSION="${VERSION}--develop.${TIMESTAMP}" | |
pnpm --filter=${{ matrix.package }} exec pnpm version $DEVELOP_VERSION --no-git-tag-version | |
pnpm --filter=${{ matrix.package }} publish --force --provenance --no-git-checks --tag develop --access public || true | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |