Skip to content

Commit

Permalink
chore: grease migration
Browse files Browse the repository at this point in the history
  • Loading branch information
unicornware committed Oct 22, 2023
1 parent e81d518 commit 7b86f4b
Show file tree
Hide file tree
Showing 48 changed files with 636 additions and 3,090 deletions.
8 changes: 0 additions & 8 deletions .dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
ardatan
attw
bdougie
booleanish
cefc
codecov
commitish
commitlintrc
dedupe
dessant
dohm
dprint
emojify
fbca
ggshield
golevelup
gpgsign
groupby
hmarr
iife
infile
jchen
keyid
ksort
larsgw
lcov
lintstagedrc
mkbuild
Expand Down
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ max_line_length = 130
max_line_length = 100

# yaml
[*.yml]
[{*.yaml,*.yml}]
max_line_length = 100
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ yarn.lock
!.cspell.json
!.dprint.*
!.github/
!.grease*.*
!.lintstagedrc.json
!.markdownlint.jsonc
!.vscode/
Expand Down
16 changes: 14 additions & 2 deletions .github/.gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ chb = "!f() { git checkout -b \"$@\" && git pou \"$@\"; }; f"
chp = "!f() { git checkout $@ && git pull; }; f"

# commit with message
cm = "!f() { git commit -s -m \"$@\"; }; f"
cm = "!f() { git commit -S -s -m \"$@\"; }; f"

# tell git to start tracking branch and push to origin
pou = "!f() { git push origin --no-verify -u $@; }; f"
Expand Down Expand Up @@ -62,7 +62,7 @@ fpnv = "!f() { git pnv --force ; }; f"
pnv = "!f() { git push --no-verify $@; }; f"

[branch]
autosetuprebase = always
autoSetupRebase = always

[checkout]
defaultRemote = origin
Expand All @@ -85,6 +85,12 @@ tool = vscode
[difftool "vscode"]
cmd = code-insiders --wait --diff $LOCAL $REMOTE

[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true

[gitflow "prefix"]
feature = feat/
hotfix = hotfix/
Expand All @@ -97,6 +103,10 @@ program = gpg2
[init]
defaultBranch = main

[log]
date = iso8601-strict
decorate = short

[merge]
tool = vscode

Expand All @@ -111,6 +121,8 @@ autoStash = true

[tag]
forceSignAnnotated = true
gpgsign = true
sort = -creatordate

[url "[email protected]:"]
insteadOf = gh:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Feature
description: Suggest new feature or improvement
title: 👀 <title>
labels:
- type:feat
- status:needs-triage
- type:feat
body:
- type: markdown
attributes:
Expand Down
14 changes: 10 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,23 @@ updates:
include: scope
directory: /
groups:
conventional-changelog:
commitlint:
patterns:
- '@types/conventional-recommended-bump'
- conventional-changelog-conventionalcommits
- conventional-recommended-bump
- '@commitlint/*'
dependencies:
dependency-type: production
eslint:
patterns:
- '@types/eslint'
- eslint
flex-development:
dependency-type: development
patterns:
- '@flex-development/*'
nestjs:
patterns:
- '@nestjs/*'
- rxjs
typescript-eslint:
patterns:
- '@typescript-eslint/*'
Expand Down
1 change: 1 addition & 0 deletions .github/infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ branches:
- context: auto-merge
- context: auto-review
- context: build
- context: changelog
- context: commitlint
- context: dependabot-dedupe
- context: format
Expand Down
41 changes: 40 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
key: ${{ steps.cache-key.outputs.result }}
path: ${{ env.CACHE_PATH }}
- id: version
name: Get package version
name: Get manifest version
run: echo "result=$(jq .version package.json -r)" >>$GITHUB_OUTPUT
- id: version-typescript
name: Get TypeScript version
Expand Down Expand Up @@ -322,6 +322,7 @@ jobs:
with:
cache: yarn
cache-dependency-path: yarn.lock
check-latest: true
node-version: ${{ matrix.node-version }}
- id: cache
if: steps.test-files-check.outputs.files_exists == 'true'
Expand Down Expand Up @@ -405,3 +406,41 @@ jobs:
with:
name: ${{ env.TARFILE }}
path: ${{ env.TARFILE }}
changelog:
needs:
- build
- commitlint
- format
- gitguardian
- lint
- preflight
- spelling
- test
- typescript
runs-on: ubuntu-latest
env:
NODE_NO_WARNINGS: 1
steps:
- id: checkout
name: Checkout ${{ env.REF_NAME }}
uses: actions/[email protected]
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ env.REF }}
- id: node
name: Setup Node.js
uses: actions/[email protected]
with:
cache: yarn
cache-dependency-path: yarn.lock
node-version-file: .nvmrc
- id: cache
name: Restore dependencies cache
uses: actions/[email protected]
with:
key: ${{ needs.preflight.outputs.cache-key }}
path: ${{ env.CACHE_PATH }}
- id: summary
name: Get changelog preview
run: echo "$(grease changelog)" >>$GITHUB_STEP_SUMMARY
52 changes: 19 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ on:
type: string
env:
REF: ${{ inputs.sha || github.event.pull_request.merge_commit_sha }}
REF_NAME: ${{ format('main@{0}', inputs.sha || github.event.pull_request.merge_commit_sha) }}
REF_NAME: |
${{ format('{0}@{1}', github.base_ref, inputs.sha || github.event.pull_request.merge_commit_sha) }}
jobs:
preflight:
if: |
(github.event.pull_request.merged && startsWith(github.head_ref, 'release/')) ||
(github.event_name == 'workflow_dispatch' && github.ref_name == 'main')
runs-on: ubuntu-latest
permissions:
contents: read
runs-on: ubuntu-latest
outputs:
prerelease: ${{ steps.dist-tag.outputs.prerelease }}
tag: ${{ steps.tag.outputs.result }}
Expand All @@ -60,11 +61,11 @@ jobs:
with:
ref: ${{ env.REF }}
- id: version
name: Get package version
name: Get release version
run: echo "result=$(jq .version package.json -r)" >>$GITHUB_OUTPUT
- id: tag-prefix
name: Get release tag prefix
run: echo "result=$(jq .tagPrefix package.json -r)" >>$GITHUB_OUTPUT
run: echo "result=$(jq .tagprefix grease.config.json -r)" >>$GITHUB_OUTPUT
- id: tag
name: Get release tag
run: |
Expand All @@ -76,23 +77,16 @@ jobs:
target: ${{ steps.version.outputs.result }}
publish:
needs: preflight
permissions:
contents: write
packages: read
runs-on: ubuntu-latest
environment:
name: release
url:
${{ format('{0}/{1}/releases/tag/{2}', github.server_url, github.repository,
needs.preflight.outputs.tag) }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
HUSKY: 0
NODE_ENV: production
NODE_NO_WARNINGS: 1
NOTES_FILE: ./RELEASE_NOTES.md
PRERELEASE: ${{ needs.preflight.outputs.prerelease }}
TAG: ${{ needs.preflight.outputs.tag }}
NOTES_FILE: RELEASE_NOTES.md
steps:
- id: checkout
name: Checkout ${{ env.REF_NAME }}
Expand All @@ -101,47 +95,39 @@ jobs:
fetch-depth: 0
persist-credentials: true
ref: ${{ env.REF }}
token: ${{ env.GITHUB_TOKEN }}
- id: gpg-import
name: Import GPG key
uses: crazy-max/[email protected]
with:
git_config_global: true
git_push_gpgsign: false
git_tag_gpgsign: true
git_user_signingkey: true
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
# todo: remove when https://github.com/crazy-max/ghaction-import-gpg/issues/118 is resolved
- id: gpg-trust
name: Set trust on GPG key
run: |
gpg --no-tty --command-fd 0 --edit-key ${{ steps.gpg-import.outputs.keyid }} << EOTRUST
trust
5
y
quit
EOTRUST
passphrase: ${{ secrets.GPG_PASSPHRASE }}
trust_level: 5
- id: yarn
name: Install dependencies
run: yarn
- id: pack
name: Pack project
env:
NODE_NO_WARNINGS: 1
run: yarn pack -o %s-%v.tgz
- id: release-notes
name: Generate release notes
run: yarn changelog --outfile $NOTES_FILE --write
run: grease changelog -wo $NOTES_FILE && echo "$(cat $NOTES_FILE)" >>$GITHUB_STEP_SUMMARY
- id: tag
name: Create annotated tag
env:
GIT_AUTHOR_EMAIL: ${{ steps.gpg-import.outputs.email }}
GIT_COMMITTER_EMAIL: ${{ steps.gpg-import.outputs.email }}
run: |
git tag --annotate --force --sign $TAG --message "release: $TAG"
git tag --verify $TAG
git push origin $TAG
run: 'grease tag -ps -m "release: {tag}" ${{ needs.preflight.outputs.version }}'
- id: publish
name: Publish release
env:
GITHUB_TOKEN: ${{ secrets.PAT_REPO }}
run: gh release create $TAG *.tgz -t=$TAG -p=$PRERELEASE -F=$NOTES_FILE
PRERELEASE: ${{ needs.preflight.outputs.prerelease }}
TAG: ${{ needs.preflight.outputs.tag }}
run: |
gh release create $TAG *.tgz --title=$TAG --notes-file=$NOTES_FILE --verify-tag --prerelease=$PRERELEASE --discussion-category=releases
- id: close-issues
name: Close released issues
uses: bdougie/close-issues-based-on-label@master
Expand Down
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"src/**/*.ts": [
"vitest --changed --coverage --run",
"yarn build",
"yarn check:types:build"
"bash -c tsc -p tsconfig.build.json"
]
}
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://docs.npmjs.com/cli/configuring-npm/npmrc

@flex-development:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${PAT_BOT}
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
//npm.pkg.github.com/:always-auth=true
Loading

0 comments on commit 7b86f4b

Please sign in to comment.