Skip to content

Commit fe28f99

Browse files
committed
feat: projen upgrade
1 parent da9d97c commit fe28f99

File tree

14 files changed

+95
-363
lines changed

14 files changed

+95
-363
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@ jobs:
1717
repository: ${{ github.event.pull_request.head.repo.full_name }}
1818
- name: Install dependencies
1919
run: yarn install --check-files --frozen-lockfile
20-
- name: Synthesize project files
21-
run: npx projen
2220
- name: Set git identity
2321
run: |-
24-
git config user.name "Auto-bump"
22+
git config user.name "Automation"
2523
git config user.email "[email protected]"
2624
- name: Build
2725
run: npx projen build
28-
- name: Upload coverage to Codecov
29-
uses: codecov/codecov-action@v1
30-
with:
31-
directory: coverage
3226
- name: Commit and push changes (if any)
3327
run: 'git diff --exit-code || (git commit -am "chore: self mutation" && git push
3428
origin HEAD:${{ github.event.pull_request.head.ref }})'
29+
- if: ${{ github.repository == github.event.pull_request.head.repo.full_name }}
30+
name: Update status check
31+
run: gh api -X POST /repos/${{ github.event.pull_request.head.repo.full_name
32+
}}/check-runs -F name="build" -F head_sha="$(git rev-parse HEAD)" -F
33+
status="completed" -F conclusion="success"
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,51 @@ on:
77
- main
88
workflow_dispatch: {}
99
jobs:
10-
build:
10+
release:
1111
runs-on: ubuntu-latest
1212
env:
1313
CI: "true"
14+
RELEASE: "true"
1415
steps:
1516
- name: Checkout
1617
uses: actions/checkout@v2
1718
with:
1819
fetch-depth: 0
1920
- name: Install dependencies
2021
run: yarn install --check-files --frozen-lockfile
21-
- name: Synthesize project files
22-
run: npx projen
2322
- name: Anti-tamper check
24-
run: git diff --exit-code
23+
run: git diff --ignore-space-at-eol --exit-code
2524
- name: Set git identity
2625
run: |-
27-
git config user.name "Auto-bump"
26+
git config user.name "Automation"
2827
git config user.email "[email protected]"
2928
- name: Bump to next version
3029
run: npx projen bump
3130
- name: Build
3231
run: npx projen build
33-
- name: Upload coverage to Codecov
34-
uses: codecov/codecov-action@v1
35-
with:
36-
directory: coverage
37-
- name: Anti-tamper check
38-
run: git diff --exit-code
39-
- name: Push commits
40-
run: git push origin HEAD:${{ github.ref }}
41-
- name: Push tags
42-
run: git push --follow-tags origin ${{ github.ref }}
32+
- name: Check for new commits
33+
id: git_remote
34+
run: echo ::set-output name=latest_commit::"$(git ls-remote origin -h ${{
35+
github.ref }} | cut -f1)"
36+
- name: Create release
37+
if: ${{ steps.git_remote.outputs.latest_commit == github.sha }}
38+
run: gh release create v$(node -p "require('./package.json').version") -F
39+
.changelog.tmp.md -t v$(node -p "require('./package.json').version")
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
- name: Unbump
43+
run: npx projen unbump
4344
- name: Upload artifact
45+
if: ${{ steps.git_remote.outputs.latest_commit == github.sha }}
4446
uses: actions/[email protected]
4547
with:
4648
name: dist
4749
path: dist
50+
- name: Anti-tamper check
51+
run: git diff --ignore-space-at-eol --exit-code
4852
release_npm:
4953
name: Release to NPM
50-
needs: build
54+
needs: release
5155
runs-on: ubuntu-latest
5256
container:
5357
image: jsii/superchain

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
.eslintcache
1111
.nyc_output
1212
.yarn-integrity
13+
/.changelog.tmp.md
14+
/.version.tmp.json
1315
/coverage
1416
/dist
1517
/lib
@@ -45,4 +47,3 @@ yarn-error.log*
4547
!/tsconfig.eslint.json
4648
!/tsconfig.jest.json
4749
!/tsconfig.json
48-
!version.json

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
/.mergify.yml
66
/.projen
77
/.projenrc.js
8-
/.versionrc.json
98
/.vscode
109
/coverage
1110
/src

.projen/deps.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
},
7373
{
7474
"name": "projen",
75-
"version": "^0.17.17",
75+
"version": "^0.17.62",
7676
"type": "build"
7777
},
7878
{

.projen/tasks.json

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,30 @@
3333
],
3434
"condition": "git diff --exit-code > /dev/null"
3535
},
36+
"bump": {
37+
"name": "bump",
38+
"category": "20.release",
39+
"description": "Bumps version based on latest git tag and generates a changelog entry",
40+
"steps": [
41+
{
42+
"exec": "git describe --tags --match=\"v*\" --first-parent --abbrev=0 > .version.tmp.json"
43+
},
44+
{
45+
"exec": "standard-version"
46+
}
47+
],
48+
"condition": "! git log --oneline -1 | grep -q \"chore(release):\""
49+
},
50+
"unbump": {
51+
"name": "unbump",
52+
"category": "20.release",
53+
"description": "Restores version to 0.0.0",
54+
"steps": [
55+
{
56+
"exec": "standard-version -r 0.0.0"
57+
}
58+
]
59+
},
3660
"compile": {
3761
"name": "compile",
3862
"category": "00.build",
@@ -77,6 +101,9 @@
77101
"category": "00.build",
78102
"description": "Full release build (test+compile)",
79103
"steps": [
104+
{
105+
"exec": "npx projen"
106+
},
80107
{
81108
"spawn": "test"
82109
},
@@ -88,31 +115,6 @@
88115
}
89116
]
90117
},
91-
"bump": {
92-
"name": "bump",
93-
"category": "20.release",
94-
"description": "Commits a bump to the package version based on conventional commits",
95-
"steps": [
96-
{
97-
"exec": "standard-version"
98-
}
99-
],
100-
"condition": "! git log --oneline -1 | grep -q \"chore(release):\""
101-
},
102-
"release": {
103-
"name": "release",
104-
"category": "20.release",
105-
"description": "Bumps version & push to main",
106-
"steps": [
107-
{
108-
"spawn": "bump"
109-
},
110-
{
111-
"exec": "git push --follow-tags origin main"
112-
}
113-
],
114-
"condition": "! git log --oneline -1 | grep -q \"chore(release):\""
115-
},
116118
"test:watch": {
117119
"name": "test:watch",
118120
"category": "10.test",

.versionrc.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{
22
"packageFiles": [
33
{
4-
"filename": "version.json",
5-
"type": "json"
4+
"filename": ".version.tmp.json",
5+
"type": "plain-text"
66
}
77
],
88
"bumpFiles": [
9-
{
10-
"filename": "version.json",
11-
"type": "json"
12-
}
9+
"package.json"
1310
],
14-
"commitAll": true,
15-
"scripts": {
16-
"postbump": "npx projen && git add ."
17-
}
11+
"commitAll": false,
12+
"infile": ".changelog.tmp.md",
13+
"header": "",
14+
"skip": {
15+
"commit": true,
16+
"tag": true
17+
},
18+
"//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"."
1819
}

0 commit comments

Comments
 (0)