Skip to content

♻️ Upgrade abstract-level version and other deps #67

♻️ Upgrade abstract-level version and other deps

♻️ Upgrade abstract-level version and other deps #67

Workflow file for this run

name: Build, Test for Main
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened,labeled]
jobs:
build:
name: Build
strategy:
matrix:
os:
- ubuntu-latest
- macOS-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: pnpm/action-setup@v4
with:
package_json_file: package.json
run_install: false
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Test
run: pnpm test
publish:
name: Publish to NPM or Create Version PR
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Generate a token
uses: actions/create-github-app-token@v1
id: generate-token
with:
# uses https://github.com/organizations/tinacms/settings/apps/release-bot-allow-prs-and-push
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_SECRET }}
- uses: actions/checkout@v4
with:
token: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
package_json_file: package.json
run_install: false
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "pnpm"
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Create Release Pull Request
id: changesets
uses: changesets/action@v1
with:
version: pnpm run version
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
- name: Set snapshot version
if: steps.changesets.outputs.hasChangesets == 'true'
run: |
timestamp=$(date +'%Y%m%d%H%M%S')
jq --arg version "0.0.0-$timestamp" '.version = $version' package.json > package.tmp.json
mv package.tmp.json package.json
- uses: JS-DevTools/npm-publish@v3
name: Publish to NPM
with:
access: public
tag: ${{ steps.changesets.outputs.hasChangesets == 'true' && 'beta' || 'latest' }}
token: ${{ secrets.NPM_AUTH_TOKEN }}
publish-pr:
name: Publish PR preview
needs: build
if: >
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'tagged')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
package_json_file: package.json
run_install: false
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "pnpm"
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Set snapshot version
run: |
timestamp=$(date +'%Y%m%d%H%M%S')
jq --arg version "0.0.0-$timestamp" '.version = $version' package.json > package.tmp.json
mv package.tmp.json package.json
- uses: JS-DevTools/npm-publish@v3
name: Publish to NPM
with:
access: public
tag: ${{ github.head_ref || github.ref_name }}
token: ${{ secrets.NPM_AUTH_TOKEN }}