Skip to content

Commit

Permalink
feat: setup semantic-release for automated releases
Browse files Browse the repository at this point in the history
  • Loading branch information
TheUnderScorer committed Oct 19, 2023
1 parent 81b17f1 commit 0232b7e
Show file tree
Hide file tree
Showing 18 changed files with 2,897 additions and 331 deletions.
9 changes: 0 additions & 9 deletions .github/actions/publish-release/action.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/actions/publish-release/index.js

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/analyze-commits.yml
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
73 changes: 0 additions & 73 deletions .github/workflows/build.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
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
12 changes: 12 additions & 0 deletions .github/workflows/coverage-diff.yml
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
15 changes: 15 additions & 0 deletions .github/workflows/docs-and-coverage.yml
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
117 changes: 117 additions & 0 deletions .github/workflows/release-old.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
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

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/github-action-json-property@v0.2.0
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/action-pull-request@v0.5.3
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 }}"
Loading

0 comments on commit 0232b7e

Please sign in to comment.