wails/.github/workflows/publish-npm.yml
2025-02-25 17:03:09 +01:00

93 lines
3.1 KiB
YAML

on:
push:
branches: ['v3-alpha']
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'v3-alpha'
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: Configure git
run: |
git config --local user.email "github-actions@github.com"
git config --local user.name "GitHub Actions"
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: "20"
- name: Clean build artifacts
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
run: npm run clean
- name: Build bundled runtime
working-directory: v3
run: |
npx --yes -p esbuild@latest exit
task runtime:build
- name: Test+Build npm package
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
run: |
npm ci
npm test
npm run prepack
- name: Detect npm package changes
uses: tj-actions/verify-changed-files@v20
id: package-changes
with:
files: |
v3/internal/runtime/desktop/@wailsio/runtime/dist/**
v3/internal/runtime/desktop/@wailsio/runtime/types/**
- name: Bump version
if: github.event_name == 'workflow_dispatch' || steps.package-changes.outputs.files_changed == 'true'
id: bump-version
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
run: |
echo "version=$(npm version prerelease)" >> $GITHUB_OUTPUT
- name: Commit changes
if: github.event_name == 'workflow_dispatch' || steps.package-changes.outputs.files_changed == 'true'
run: |
git add .
git commit -m "[skip ci] Publish @wailsio/runtime ${{ steps.bump-version.outputs.version }}"
git push
- name: Publish npm package
uses: JS-DevTools/npm-publish@v3
if: github.event_name == 'workflow_dispatch' || steps.package-changes.outputs.files_changed == 'true'
with:
package: v3/internal/runtime/desktop/@wailsio/runtime
access: public
token: ${{ secrets.NPM_TOKEN }}
- name: Detect docs and bundled runtime changes
if: github.event_name != 'workflow_dispatch' && steps.package-changes.outputs.files_changed != 'true'
uses: tj-actions/verify-changed-files@v20
id: docs-bundle-changes
with:
files: |
v3/internal/assetserver/bundledassets/**
v3/internal/runtime/desktop/@wailsio/runtime/docs/**
- name: Commit docs and bundled runtime changes
if: github.event_name != 'workflow_dispatch' && steps.package-changes.outputs.files_changed != 'true' && steps.docs-bundle-changes.outputs.files_changed == 'true'
run: |
git add .
git commit -m "[skip ci] Update runtime docs and bundle"
git push