-
Notifications
You must be signed in to change notification settings - Fork 5
ci: use shared obsidian plugin workflow and update obsidian version #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,179 +1,22 @@ | ||
| name: CI/CD | ||
|
|
||
| permissions: | ||
| contents: read | ||
| contents: write | ||
| issues: write | ||
| pull-requests: write | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - master | ||
| - '**' | ||
| branches: [main, master, '**'] | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| branches: | ||
| - main | ||
| - master | ||
|
|
||
| jobs: | ||
| filter: | ||
| name: Check for Code Changes | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| code: ${{ steps.filter.outputs.code }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dorny/paths-filter@v3 | ||
| id: filter | ||
| with: | ||
| filters: | | ||
| code: | ||
| - 'src/**' | ||
| - 'package.json' | ||
| - 'package-lock.json' | ||
| - 'tsconfig.json' | ||
| - 'esbuild.config.mjs' | ||
| - 'eslint.config.mts' | ||
| - 'vitest.config.ts' | ||
| - 'styles.css' | ||
| - 'main.js' | ||
|
|
||
| lint: | ||
| name: Lint | ||
| needs: filter | ||
| if: needs.filter.outputs.code == 'true' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: '22' | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| - run: npm run lint | ||
|
|
||
| test: | ||
| name: Test | ||
| needs: filter | ||
| if: needs.filter.outputs.code == 'true' | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| version: ${{ steps.version.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: '22' | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| - run: npm run test -- --coverage | ||
| - id: version | ||
| run: echo "version=$(node -p "require('./manifest.json').version")" >> $GITHUB_OUTPUT | ||
| - name: Upload coverage | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: coverage-report | ||
| path: coverage/ | ||
|
|
||
| sonar: | ||
| name: SonarQube | ||
| needs: [filter, test] | ||
| if: (needs.filter.outputs.code == 'true') && (github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | ||
| runs-on: ubuntu-latest | ||
| continue-on-error: true | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Download coverage | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| name: coverage-report | ||
| path: coverage/ | ||
| - name: SonarQube Scan | ||
| uses: SonarSource/sonarqube-scan-action@v7.1.0 | ||
| env: | ||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
| SONAR_HOST_URL: https://sonarcloud.io | ||
| with: | ||
| args: > | ||
| -Dsonar.qualitygate.wait=true | ||
| -Dsonar.scanner.dumpToFile=sonar-project.properties | ||
| - name: Upload Sonar logs | ||
| if: always() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: sonar-scan-logs | ||
| path: | | ||
| .scannerwork/ | ||
| sonar-project.properties | ||
|
|
||
| artifact: | ||
| name: Package Artifact | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| needs: [filter, test] | ||
| # Run on PRs or feature branches if code changed | ||
| if: needs.filter.outputs.code == 'true' && (github.event_name == 'pull_request' || (github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master')) | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: '22' | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| - run: npm run build | ||
| - name: Create plugin package | ||
| run: | | ||
| VERSION=${{ needs.test.outputs.version }} | ||
| BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | ||
| BRANCH_NAME_SAFE=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9._-]/-/g') | ||
| ZIP_NAME="git-files-sync-${VERSION}-${BRANCH_NAME_SAFE}.zip" | ||
| zip -j "$ZIP_NAME" main.js manifest.json styles.css | ||
| echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV | ||
| - uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: plugin-build-${{ needs.test.outputs.version }}-${{ github.sha }} | ||
| path: ${{ env.ZIP_NAME }} | ||
| retention-days: 7 | ||
|
|
||
| release: | ||
| name: Build and Release | ||
| runs-on: ubuntu-latest | ||
| needs: [filter, lint, test, sonar] | ||
| # Only run on push to main/master if code changed | ||
| if: needs.filter.outputs.code == 'true' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | ||
| permissions: | ||
| contents: write | ||
| issues: write | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: '22' | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| - run: npm run build | ||
| - env: | ||
| GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }} | ||
| run: npx semantic-release | ||
|
|
||
| status: | ||
| name: CI/CD Status | ||
| runs-on: ubuntu-latest | ||
| if: always() | ||
| needs: [filter, lint, test, sonar, artifact, release] | ||
| steps: | ||
| - name: Check for failures | ||
| if: | | ||
| contains(needs.*.result, 'failure') || | ||
| contains(needs.*.result, 'cancelled') || | ||
| (needs.filter.result == 'skipped') | ||
| run: exit 1 | ||
| - name: Success | ||
| run: echo "All required checks passed or were appropriately skipped" | ||
| CI: | ||
| uses: firstsun-dev/general-workflows/.github/workflows/obsidian-plugin-ci.yml@main | ||
| with: | ||
| plugin-id: "git-file-sync" | ||
| skip-sonar: false | ||
| secrets: | ||
| RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} | ||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,3 +46,4 @@ | |
| "obsidian": "latest" | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1 +1 @@ | ||||||
| {"1.0.0": "0.15.0", "1.1.0": "0.15.0"} | ||||||
| {"1.0.0": "0.15.0", "1.1.0": "1.12.7"} | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a version mismatch between the
Suggested change
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Including a specific feature branch (
feat/use-shared-workflow) in thebranchesarray will causesemantic-releaseto attempt a release from this branch. Typically, this configuration should only include stable branches (e.g.,main,master) or designated pre-release branches. If this was added only for testing the CI changes, it should be removed before merging to avoid accidental releases or configuration clutter.