-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from fingerprintjs/INTER-810-semantic-release
[INTER-810] Add changesets and schema sync action
- Loading branch information
Showing
12 changed files
with
945 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "restricted", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [], | ||
"privatePackages": { | ||
"tag": true, | ||
"version": true | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
get-token: | ||
name: Get token | ||
environment: production | ||
runs-on: ubuntu-latest | ||
outputs: | ||
token: ${{ steps.app-token.outputs.token }} | ||
steps: | ||
- name: 'Get token for the GitHub App' | ||
uses: actions/create-github-app-token@f2acddfb5195534d487896a656232b016a682f3c | ||
id: app-token | ||
with: | ||
app-id: ${{ inputs.app-id }} | ||
private-key: ${{ secrets.APP_PRIVATE_KEY }} | ||
release: | ||
needs: [get-token] | ||
name: 'Release project' | ||
uses: fingerprintjs/dx-team-toolkit/.github/workflows/release-sdk-changesets.yml@v1 | ||
with: | ||
version-command: pnpm changeset-version | ||
publish-command: pnpm exec changeset publish | ||
language: node | ||
language-version: '21' | ||
prepare-command: | | ||
pnpm build | ||
secrets: | ||
# We can't use default token, because it will result on not triggering the "upload-changesets.yml" workflow on release | ||
GH_RELEASE_TOKEN: ${{ needs.get-token.outputs.token }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'Release tag' | ||
required: true | ||
type: string | ||
pre-release: | ||
description: 'Whether to create a pre-release first for the SDKs' | ||
required: false | ||
default: false | ||
name: Sync Server-Side SDKs schema | ||
jobs: | ||
sync-node: | ||
name: 'Sync schema in Node SDK' | ||
uses: fingerprintjs/dx-team-toolkit/.github/workflows/update-server-side-sdk-schema.yml@v1 | ||
with: | ||
tag: ${{ inputs.tag }} | ||
language: node | ||
language-version: 21 | ||
generate-command: 'pnpm generateTypes' | ||
schema-path: resources/fingerprint-server-api.yaml | ||
examples-path: tests/mocked-responses-tests/mocked-responses-data | ||
app-id: ${{ vars.APP_ID }} | ||
repository: fingerprintjs-pro-server-api-node-sdk | ||
pre-release: ${{ inputs.pre-release }} | ||
ignored-scopes: visitors-api | ||
secrets: | ||
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Upload changesets | ||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
upload-changesets: | ||
name: Upload changesets | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.release.tag_name }} | ||
|
||
- name: 'Install pnpm' | ||
uses: pnpm/action-setup@129abb77bf5884e578fcaf1f37628e41622cc371 | ||
with: | ||
version: 9 | ||
run_install: true | ||
|
||
- name: Upload an Asset in GitHub Release | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const script = require('./scripts/uploadChangesets.cjs') | ||
script({github, context, token: ${{ secrets.GITHUB_TOKEN }}}) | ||
cleanup-changesets: | ||
runs-on: ubuntu-latest | ||
needs: upload-changesets | ||
environment: production | ||
steps: | ||
- name: 'Get token for the GitHub App' | ||
if: ${{ vars.appId != '' }} | ||
uses: actions/create-github-app-token@f2acddfb5195534d487896a656232b016a682f3c | ||
id: app-token | ||
with: | ||
app-id: ${{ vars.appId }} | ||
private-key: ${{ secrets.APP_PRIVATE_KEY }} | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
token: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }} | ||
|
||
- name: Remove changesets zip files | ||
run: rm .changeset/changesets-*.zip | ||
|
||
- name: Commit changes | ||
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 | ||
with: | ||
add: '.' | ||
github_token: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }} | ||
message: 'chore(skip-ci): remove changesets zip files' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// This file needs to be in CommonJS format, otherwise changesets crash because they don't support ESM for now. | ||
const commonDxTeamPrettierConfig = require('@fingerprintjs/prettier-config-dx-team'); | ||
|
||
module.exports = { | ||
...commonDxTeamPrettierConfig, | ||
semi: true, | ||
}; |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.