-
Notifications
You must be signed in to change notification settings - Fork 0
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 #164 from fingerprintjs/feature/INTER-166-semantic…
…-release feat: setup semantic-release for automated releases
- Loading branch information
Showing
17 changed files
with
2,774 additions
and
332 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Analyze Commit Messages | ||
on: | ||
pull_request: | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: write | ||
jobs: | ||
analyze-commits: | ||
name: Generate docs and coverage report | ||
uses: fingerprintjs/dx-team-toolkit/.github/workflows/analyze-commits.yml@v1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: ci | ||
on: | ||
push: | ||
branches-ignore: | ||
- main | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
build-and-check: | ||
name: Build project and run CI checks | ||
uses: fingerprintjs/dx-team-toolkit/.github/workflows/build-typescript-project.yml@v1 |
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,12 @@ | ||
name: Check coverage for PR | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
run-tests-check-coverage: | ||
name: Run tests & check coverage | ||
permissions: | ||
checks: write | ||
pull-requests: write | ||
uses: fingerprintjs/dx-team-toolkit/.github/workflows/coverage-diff.yml@v1 |
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 @@ | ||
name: Generate docs and coverage report | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
generate-docs-and-coverage: | ||
name: Generate docs and coverage report | ||
uses: fingerprintjs/dx-team-toolkit/.github/workflows/docs-and-coverage.yml@v1 | ||
with: | ||
skip-docs-step: true | ||
prepare-gh-pages-commands: | | ||
mv coverage/lcov-report ./gh-pages/coverage |
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 |
---|---|---|
@@ -1,117 +1,13 @@ | ||
name: Release | ||
|
||
name: release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
prerelease: | ||
description: 'Create a pre-release' | ||
default: 'false' | ||
required: false | ||
type: boolean | ||
version_bump: | ||
description: 'A type of version bump' | ||
default: 'patch' | ||
required: true | ||
type: choice | ||
options: | ||
- major | ||
- minor | ||
- patch | ||
push: | ||
branches: | ||
- main | ||
- test | ||
|
||
jobs: | ||
release: | ||
name: Release Azure integration distribution | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
if: github.ref == 'refs/heads/develop' | ||
|
||
steps: | ||
- name: Checkout develop branch | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: develop | ||
fetch-depth: 0 | ||
|
||
- name: Install node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.node-version' | ||
|
||
- name: Set git settings | ||
uses: fregante/setup-git-user@v1 | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Lint | ||
run: yarn lint | ||
|
||
- name: Run tests | ||
run: yarn test | ||
|
||
- name: Disable version tags | ||
run: yarn config set version-git-tag false | ||
|
||
- name: Bump version | ||
run: yarn version --${{ github.event.inputs.version_bump }} | ||
|
||
- name: Build functions | ||
run: yarn build | ||
env: | ||
NODE_OPTIONS: "--max_old_space_size=4096" | ||
FPCDN: fpcdn.io | ||
INGRESS_API: api.fpjs.io | ||
IS_RELEASE_BUILD: true | ||
|
||
- name: Get new version of function | ||
id: new_version | ||
uses: notiz-dev/[email protected] | ||
with: | ||
path: 'package.json' | ||
prop_path: 'version' | ||
|
||
- name: Prepare a package | ||
run: | | ||
cd dist | ||
zip -r package.zip * | ||
mv package.zip ../ | ||
cd ../ | ||
cp package.zip v${{steps.new_version.outputs.prop}}.zip | ||
- name: Commit and push new version of lambda | ||
run: | | ||
git commit package.json -m "chore: release v${{steps.new_version.outputs.prop}}" | ||
git push "https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" | ||
git tag -a "v${{steps.new_version.outputs.prop}}" -m "v${{steps.new_version.outputs.prop}}" | ||
git push --tags "https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" | ||
## Prepare a release | ||
- name: Create a Github release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: v${{steps.new_version.outputs.prop}} | ||
name: v${{steps.new_version.outputs.prop}} | ||
draft: true | ||
prerelease: ${{ github.event.inputs.prerelease }} | ||
artifacts: v${{steps.new_version.outputs.prop}}.zip,package.zip | ||
artifactContentType: 'application/zip' | ||
generateReleaseNotes: true | ||
|
||
- name: Create Pull Request from develop to main | ||
id: create_pr | ||
uses: devops-infra/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
source_branch: develop | ||
target_branch: main | ||
title: v${{ steps.new_version.outputs.prop }} | ||
body: New version of scripts v${{ steps.new_version.outputs.prop }} | ||
label: release | ||
|
||
- name: Check PR outputs | ||
if: ${{ steps.create_pr.outputs.url }} | ||
run: echo "Pull Request URL - ${{ steps.create_pr.outputs.url }}" | ||
build-and-release: | ||
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 }} |
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,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx commitlint --edit $1 |
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,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
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 @@ | ||
#!/bin/bash | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
containsref() { if [[ $2 =~ $1 ]]; then echo 1; else echo 0; fi } | ||
|
||
push_command=$(ps -ocommand= -p $PPID | cut -d' ' -f 4) | ||
protected_branch='main' | ||
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | ||
is_push_to_main_origin=$(containsref '[email protected]:/?fingerprintjs/' "$push_command") | ||
|
||
# Block pushes only to protected branch in main repository | ||
if [ $is_push_to_main_origin = 1 ] && [ "$protected_branch" = "$current_branch" ]; then | ||
echo "You are on the $protected_branch branch, push blocked." | ||
exit 1 # push will not execute | ||
fi |
Oops, something went wrong.