Simplify ci pipeline

This commit is contained in:
Fabio Massaioli 2025-02-28 22:31:10 +01:00
commit 2a424f6be5

View file

@ -12,8 +12,7 @@ jobs:
name: Detect committed changes
if: github.event_name != 'workflow_dispatch'
outputs:
rebuild: ${{ steps.source-changes.outputs.any_modified == 'true' }}
publish: ${{ steps.package-json-changes.outputs.any_modified == 'true' || steps.build-artifact-changes.outputs.any_modified == 'true' }}
changed: ${{ steps.package-json-changes.outputs.any_modified == 'true' || steps.source-changes.outputs.any_modified == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
@ -29,19 +28,9 @@ jobs:
files: |
v3/internal/runtime/desktop/@wailsio/runtime/package.json
- name: Detect committed build artifact changes
if: steps.package-json-changes.outputs.any_modified != 'true'
id: build-artifact-changes
uses: tj-actions/changed-files@v45
with:
files: |
v3/internal/runtime/desktop/@wailsio/runtime/dist/**
v3/internal/runtime/desktop/@wailsio/runtime/types/**
- name: Detect committed source changes
if: >-
steps.package-json-changes.outputs.any_modified != 'true'
&& steps.build-artifact-changes.outputs.any_modified != 'true'
id: source-changes
uses: tj-actions/changed-files@v45
with:
@ -58,9 +47,7 @@ jobs:
needs: [detect]
if: >-
!failure() && !cancelled()
&& (github.event_name == 'workflow_dispatch' || needs.detect.outputs.publish == 'true' || needs.detect.outputs.rebuild == 'true')
env:
publish: ${{ github.event_name == 'workflow_dispatch' || needs.detect.outputs.publish == 'true' }}
&& (github.event_name == 'workflow_dispatch' || needs.detect.outputs.changed == 'true')
runs-on: ubuntu-latest
steps:
- name: Checkout code
@ -106,44 +93,21 @@ jobs:
npm test
npm run build
- name: Detect build artifact changes
if: env.publish != 'true'
uses: tj-actions/verify-changed-files@v20
id: build-artifact-changes
with: |
v3/internal/runtime/desktop/@wailsio/runtime/dist/**
v3/internal/runtime/desktop/@wailsio/runtime/types/**
- name: Publish required?
id: publish-required
env:
required: ${{ env.publish == 'true' || steps.build-artifact-changes.outputs.files_changed == 'true' }}
run: echo "required=$required" >> "$GITHUB_OUTPUT"
- name: Bump version
if: steps.publish-required.outputs.required == 'true'
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
env:
new_version: ${{ steps.publish-required.outputs.required }}
run: |
git add .
if git diff --cached --quiet; then
if [ "$new_version" = "true" ]; then
git commit -m "[skip ci] Publish @wailsio/runtime ${{ steps.bump-version.outputs.version }}"
else
git commit -m "[skip ci] Update runtime docs and bundle"
fi
git push
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
if: steps.publish-required.outputs.required == 'true'
with:
package: v3/internal/runtime/desktop/@wailsio/runtime
access: public