Skip to content

Commit

Permalink
Merge pull request #28 from fingerprintjs/migrate-to-reusabel-workflo…
Browse files Browse the repository at this point in the history
…ws-INTER-192

Migrate to reusable workflows
  • Loading branch information
ilfa authored Aug 25, 2023
2 parents 511181b + 5673591 commit 0f84f39
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 2,215 deletions.
32 changes: 5 additions & 27 deletions .github/workflows/analyze-commits.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,11 @@
name: Analyze Commit Messages
on: [pull_request]
on:
pull_request:

permissions:
pull-requests: write
contents: write
jobs:
release-notes-comment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Collect semantic-release-info
id: semantic_release_info
uses: fingerprintjs/action-semantic-release-info@v1
- if: ${{ steps.semantic_release_info.outputs.no_release == 'false' }}
name: Add comment to the PR
uses: marocchino/sticky-pull-request-comment@3d60a5b2dae89d44e0c6ddc69dd7536aec2071cd
with:
header: ReleasePreview
recreate: true
message: |
## This PR will create a ${{steps.semantic_release_info.outputs.type}} release :rocket:
${{steps.semantic_release_info.outputs.notes}}
- if: ${{ steps.semantic_release_info.outputs.no_release == 'true' }}
name: Add comment to the PR
uses: marocchino/sticky-pull-request-comment@3d60a5b2dae89d44e0c6ddc69dd7536aec2071cd
with:
header: ReleasePreview
recreate: true
message: |
## This PR will not create a new release :rocket:
analyze-commits:
name: Generate docs and coverage report
uses: fingerprintjs/dx-team-toolkit/.github/workflows/analyze-commits.yml@v1
28 changes: 3 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,6 @@ name: Lint, build and test
on:
pull_request:
jobs:
build:
name: Lint, build and test
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache
uses: actions/cache@v3
with:
path: |
**/node_modules
!**/dist/node_modules
key: nodemodules-${{ hashFiles('**/yarn.lock') }}
restore-keys: nodemodules-
- name: Install Node packages
run: yarn install
- name: Lint
run: yarn lint
- name: Tests
run: yarn test
- name: Build
run: yarn build
- name: Typecheck
run: yarn test:dts
build-and-check:
name: Build project and run CI checks
uses: fingerprintjs/dx-team-toolkit/.github/workflows/build-typescript-project.yml@v1
23 changes: 1 addition & 22 deletions .github/workflows/coverage-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,9 @@ on:

jobs:
run-tests-check-coverage:
runs-on: ubuntu-20.04
name: Run tests & check coverage
permissions:
checks: write
pull-requests: write
contents: read # for private repos
steps:
- uses: actions/checkout@v3
- name: Jest coverage comment
id: coverage
uses: ArtiomTr/jest-coverage-report-action@f1a1382101d9b92b38e3df05c9ed89a834af97c8
with:
package-manager: yarn
output: report-markdown
- run: yarn test:coverage
- name: Read coverage text report
uses: fingerprintjs/action-coverage-report-md@v1
id: coverage-md
- uses: marocchino/sticky-pull-request-comment@adca94abcaf73c10466a71cc83ae561fd66d1a56
with:
message: |
${{ steps.coverage.outputs.report }}
<details>
<summary>Show full coverage report</summary>
${{ steps.coverage-md.outputs.markdownReport }}
</details>
uses: fingerprintjs/dx-team-toolkit/.github/workflows/coverage-diff.yml@v1
33 changes: 2 additions & 31 deletions .github/workflows/docs-and-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,5 @@ on:

jobs:
generate-docs-and-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3

- name: Install dependencies
run: yarn install

- name: Create the docs
run: yarn run docs

- name: Collect coverage report
run: yarn test:coverage

- name: Create Coverage Badges
uses: jaywcjlove/coverage-badges-cli@e07f25709cd25486855c1ba1b26da53576ff3620
with:
source: coverage/coverage-summary.json
output: coverage/lcov-report/badges.svg

- name: Prepare folder for gh-pages
run: |
mkdir gh-pages
mv docs ./gh-pages
mv coverage/lcov-report ./gh-pages/coverage
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@ba1486788b0490a235422264426c45848eac35c6
with:
branch: gh-pages
folder: gh-pages
name: Generate docs and coverage report
uses: fingerprintjs/dx-team-toolkit/.github/workflows/docs-and-coverage.yml@v1
27 changes: 6 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,10 @@ on:
workflow_dispatch:

jobs:
release:
build-and-release:
# Don't forget to configure production environment after repository is made public to require approval before triggering!
environment: production
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Install dependencies
run: yarn install

- name: Build library
run: yarn build

- name: Release
run: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
HUSKY: 0
name: 'Build project, run CI checks and publish new release'
uses: fingerprintjs/dx-team-toolkit/.github/workflows/release-typescript-project.yml@v1
secrets:
GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"test": "jest",
"test:coverage": "jest --coverage",
"test:dts": "tsc --noEmit --isolatedModules dist/template-ts.d.ts",
"docs": "typedoc src/index.ts --out docs",
"release": "semantic-release"
"docs": "typedoc src/index.ts --out docs"
},
"main": "dist/template-ts.cjs.js",
"module": "dist/template-ts.esm.js",
Expand All @@ -39,10 +38,6 @@
"@commitlint/config-conventional": "^17.0.2",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-typescript": "^8.3.3",
"@semantic-release/changelog": "6.0.1",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "8.0.4",
"@semantic-release/npm": "9.0.1",
"@types/jest": "^28.1.3",
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.12.0",
Expand All @@ -62,7 +57,6 @@
"rollup-plugin-dts": "^4.2.2",
"rollup-plugin-license": "^2.8.1",
"rollup-plugin-peer-deps-external": "^2.2.4",
"semantic-release": "19.0.3",
"ts-jest": "^28.0.5",
"typedoc": "^0.22.17",
"typescript": "^4.7.4"
Expand Down
Loading

0 comments on commit 0f84f39

Please sign in to comment.