Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #19 from postfinance/feature/semantic-release
Browse files Browse the repository at this point in the history
ci: introduce semantic-release
  • Loading branch information
bbortt authored Sep 26, 2022
2 parents d742113 + 81c1168 commit 34187dc
Show file tree
Hide file tree
Showing 12 changed files with 11,926 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"@commitlint/config-conventional"
]
}
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ updates:
interval: 'weekly'
assignees:
- 'bbortt'
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
assignees:
- 'bbortt'
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- '**/*'
jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: publish
name: docker
on:
pull_request:
push:
branches:
- release
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
publish:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: lint
on:
pull_request:
jobs:
commitlint:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: 'npm'
node-version: 16
- name: Fetch Release Information
run: git fetch origin release
- name: Install Dependencies
run: npm ci
- name: Lint Commit Messages
run: |
npx --no-install commitlint --from origin/release --to HEAD --verbose
25 changes: 25 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: release
on:
push:
branches:
- release
jobs:
release:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: 'npm'
node-version: 16
- name: Install Dependencies
run: npm ci
- name: Create next release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx semantic-release
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.iml

.idea/

node_modules/
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit
24 changes: 24 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"branches": [
"release"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"assets": [
{
"path": "README.md",
"label": "CSS distribution"
},
{
"path": "dist/asset.min.js",
"label": "JS distribution"
}
]
}
]
]
}
33 changes: 32 additions & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,41 @@
Contents:

* [Automatic Versioning](#automatic-versioning)
* [Docker Tagging](#docker-tagging)

## Automatic Versioning

The automatic versioning happens in the [build action](https://github.com/postfinance/polling-swagger-ui/actions)
You must follow [the conventional commit messages pattern](https://www.conventionalcommits.org/en/v1.0.0/) when
contributing to this repository!

> Conventional Commits: A specification for adding human and machine readable meaning to commit messages.
The commit message should be structured as follows:

```shell
<type>[optional scope]: <description>

[optional body]

[optional footer(s)]
```

Consider reading [the summary](https://www.conventionalcommits.org/en/v1.0.0/#summary) if you don't know anything about
the available types.

### `semantic-release`

The pipeline uses [`semantic-release`](https://github.com/semantic-release/semantic-release/) internally. Take a look at
the [`release`-workflow](https://github.com/postfinance/polling-swagger-ui/blob/release/.github/workflows/release.yaml)
or
[the official documentation](https://github.com/semantic-release/github/) in order to get started.

An access token (`GITHUB_TOKEN`) with the following scope is required for `semantic-release` to work properly: `public_repo`
.

## Docker Tagging

Docker image tagging happens in the [build action](https://github.com/postfinance/polling-swagger-ui/actions)
according to SemVer. It uses the [`docker/metadata-action`](https://github.com/docker/metadata-action#semver):

| Event | Ref | Docker Tags |
Expand Down
Loading

0 comments on commit 34187dc

Please sign in to comment.