Skip to content

Commit a45f74b

Browse files
fix: inital semantic release setup and release
1 parent be3894c commit a45f74b

File tree

7 files changed

+4680
-106
lines changed

7 files changed

+4680
-106
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Check PR title
2+
on:
3+
pull_request_target:
4+
branches: [master]
5+
types:
6+
- opened
7+
- reopened
8+
- edited
9+
- synchronize
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: aslafy-z/conventional-pr-title-action@v2.2.3
16+
id: title-check
17+
with:
18+
success-state: Title follows the specification.
19+
failure-state: Title does not follow the specification.
20+
context-name: conventional-pr-title
21+
preset: conventional-changelog-angular@latest
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Find Comment
26+
if: always()
27+
uses: peter-evans/find-comment@v1
28+
id: fc
29+
with:
30+
issue-number: ${{ github.event.pull_request.number }}
31+
comment-author: "github-actions[bot]"
32+
body-includes: Please make sure that your Pull Request title and body does conform to this format
33+
34+
- name: Create comment
35+
if: always() && (steps.fc.outputs.comment-id == 0) && (steps.title-check.outputs.success == 'false')
36+
uses: peter-evans/create-or-update-comment@v1
37+
with:
38+
issue-number: ${{ github.event.pull_request.number }}
39+
body: |
40+
We are following the [Conventional Commit Format](https://www.conventionalcommits.org/en/v1.0.0/). Please make sure that your Pull Request title and body does conform to this format, otherwise, it might not be released. Here is a short example:
41+
```
42+
fix(webapp): correct styling in cool component
43+
<type>[optional scope]: <description>
44+
```
45+
These are the most used types: (you can find more [here](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type))
46+
| Type | Meaning | Resulting Semantic Release
47+
| :------------- |:-------------|:----:|
48+
| `fix` | patches a bug | PATCH (v1.0.0 -> v1.0.1)|
49+
| `feat` | introduces a new feature | MINOR (v1.0.0 -> v1.1.0)|
50+
| `chore` | other non releasing code changes | NONE (v1.0.0 -> v1.0.0|
51+
52+
In the Pull Request Body please describe what changes for the user of the application. If the user has to do Things different than before (excluding new functionality) please include `BREAKING CHANGE` at the end. This will trigger a major release (v1.0.0 -> v2.0.0)
53+
54+
- name: Delete comment
55+
if: always() && (steps.fc.outputs.comment-id != 0) && (steps.title-check.outputs.success == 'true')
56+
uses: actions/github-script@v3
57+
with:
58+
script: |
59+
github.issues.deleteComment({
60+
owner: context.repo.owner,
61+
repo: context.repo.repo,
62+
comment_id: ${{ steps.fc.outputs.comment-id }},
63+
})

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Use Node.js 14.x
13+
uses: actions/setup-node@v1
14+
with:
15+
node-version: '14.x'
16+
- uses: actions/cache@v2
17+
id: npm-cache
18+
with:
19+
path: "**/node_modules"
20+
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
21+
- name: Install dependencies
22+
if: steps.npm-cache.outputs.cache-hit != 'true'
23+
run: npm ci
24+
- name: Link dockerproxy
25+
run: npm link
26+
- name: Install test framework
27+
run: |
28+
sudo add-apt-repository -y ppa:duggan/bats
29+
sudo apt-get update
30+
sudo apt-get install -y bats
31+
- name: Test
32+
run: bats --tap test
33+
34+
release:
35+
name: Release
36+
runs-on: ubuntu-latest
37+
needs: [test]
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v2
41+
with:
42+
fetch-depth: 0
43+
- name: Setup Node.js
44+
uses: actions/setup-node@v1
45+
with:
46+
node-version: 14
47+
- uses: actions/cache@v2
48+
id: npm-cache
49+
with:
50+
path: "**/node_modules"
51+
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
52+
- name: Install dependencies
53+
if: steps.npm-cache.outputs.cache-hit != 'true'
54+
run: npm install
55+
- name: Release
56+
id: semantic
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
60+
run: npm run release

.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.travis.yml
2-
settings.json
2+
settings.json
3+
scripts

.releaserc.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"branches": ["master"],
3+
"verifyConditions": ["@semantic-release/changelog", "@semantic-release/github"],
4+
"verifyConfig": ["@semantic-release/github"],
5+
"prepare": [
6+
{
7+
"path": "@semantic-release/exec",
8+
"cmd": "node ./scripts/getChangelog.js ${lastRelease.version}"
9+
},
10+
{
11+
"path": "@semantic-release/changelog",
12+
"changelogFile": "changelog.md"
13+
}
14+
],
15+
"publish": [
16+
{
17+
"path": "@semantic-release/github",
18+
"assets": [
19+
{
20+
"path": "changelog.md",
21+
"label": "Changelog"
22+
}
23+
]
24+
},
25+
{
26+
"path": "@semantic-release/exec",
27+
"cmd": "echo \"::set-output name=RELEASED::true\""
28+
},
29+
{
30+
"path": "@semantic-release/exec",
31+
"cmd": "echo \"::set-output name=VERSION::${nextRelease.version}\""
32+
}
33+
],
34+
"fail": ["@semantic-release/github"],
35+
"success": ["@semantic-release/github"],
36+
"plugins": [
37+
[
38+
"@semantic-release/commit-analyzer",
39+
{
40+
"preset": "angular",
41+
"releaseRules": [
42+
{
43+
"type": "trans",
44+
"release": "patch"
45+
}
46+
]
47+
}
48+
],
49+
"@semantic-release/release-notes-generator"
50+
]
51+
}

0 commit comments

Comments
 (0)