Update Results stage in pipeline #300
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
on: | |
push: | |
branches: ['v3-alpha'] | |
workflow_dispatch: | |
concurrency: | |
group: publish-npm-v3 | |
cancel-in-progress: true | |
jobs: | |
detect: | |
name: Detect committed changes | |
if: github.event_name != 'workflow_dispatch' | |
outputs: | |
changed: ${{ steps.package-json-changes.outputs.any_modified == 'true' || steps.source-changes.outputs.any_modified == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
persist-credentials: 'true' | |
- name: Detect committed package.json changes | |
id: package-json-changes | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: | | |
v3/internal/runtime/desktop/@wailsio/runtime/package.json | |
- name: Detect committed source changes | |
if: >- | |
steps.package-json-changes.outputs.any_modified != 'true' | |
id: source-changes | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: | | |
v3/internal/runtime/Taskfile.yaml | |
v3/internal/runtime/desktop/@wailsio/compiled/main.js | |
v3/internal/runtime/desktop/@wailsio/runtime/tsconfig.json | |
v3/internal/runtime/desktop/@wailsio/runtime/src/** | |
v3/pkg/events/events.txt | |
v3/tasks/events/** | |
rebuild_and_publish: | |
name: Rebuild and publish | |
needs: [detect] | |
if: >- | |
!failure() && !cancelled() | |
&& (github.event_name == 'workflow_dispatch' || needs.detect.outputs.changed == 'true') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
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@v4 | |
with: | |
node-version: "20" | |
- name: Install dependencies | |
working-directory: v3/internal/runtime/desktop/@wailsio/runtime | |
run: | | |
npm ci | |
npx --yes esbuild@latest --version | |
- name: Clean build artifacts | |
working-directory: v3/internal/runtime/desktop/@wailsio/runtime | |
run: npm run clean | |
- name: Build bundled runtime | |
working-directory: v3 | |
run: task runtime:build | |
- name: Test+Build npm package | |
working-directory: v3/internal/runtime/desktop/@wailsio/runtime | |
run: | | |
npm test | |
npm run build | |
- name: Bump version | |
id: bump-version | |
working-directory: v3/internal/runtime/desktop/@wailsio/runtime | |
run: | | |
echo "version=$(npm --no-git-tag-version --force version prerelease)" >> "$GITHUB_OUTPUT" | |
- name: Commit changes | |
run: | | |
git add . | |
git commit -m "[skip ci] Publish @wailsio/runtime ${{ steps.bump-version.outputs.version }}" | |
git push | |
fi | |
- name: Publish npm package | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
package: v3/internal/runtime/desktop/@wailsio/runtime | |
access: public | |
token: ${{ secrets.NPM_TOKEN }} |