ci: setup release workflow (#200)
This commit is contained in:
parent
ec534714a6
commit
b21daf0d29
7 changed files with 193 additions and 30 deletions
26
.github/workflows/lint-pr-title.yml
vendored
26
.github/workflows/lint-pr-title.yml
vendored
|
|
@ -1,26 +0,0 @@
|
||||||
name: 'Lint PR title'
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request_target:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- edited
|
|
||||||
- synchronize
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
name: Validate PR title
|
|
||||||
if: github.repository == 'KonradSzwarc/devscard'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: amannn/action-semantic-pull-request@v5
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
types: |
|
|
||||||
feat
|
|
||||||
fix
|
|
||||||
chore
|
|
||||||
refactor
|
|
||||||
docs
|
|
||||||
requireScope: false
|
|
||||||
25
.github/workflows/main-branch.yml
vendored
25
.github/workflows/main-branch.yml
vendored
|
|
@ -80,7 +80,6 @@ jobs:
|
||||||
percy:
|
percy:
|
||||||
name: Run Percy check
|
name: Run Percy check
|
||||||
if: github.repository == 'KonradSzwarc/devscard'
|
if: github.repository == 'KonradSzwarc/devscard'
|
||||||
needs: deploy
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
@ -111,3 +110,27 @@ jobs:
|
||||||
with:
|
with:
|
||||||
urls: ${{ needs.deploy.outputs.deploy-url }}
|
urls: ${{ needs.deploy.outputs.deploy-url }}
|
||||||
device: all
|
device: all
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Create release
|
||||||
|
if: github.repository == 'KonradSzwarc/devscard'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Get project information
|
||||||
|
id: projectinfo
|
||||||
|
uses: gregoranders/nodejs-project-info@v0.0.19
|
||||||
|
- name: Get changelog entries
|
||||||
|
id: changelog_reader
|
||||||
|
uses: mindsers/changelog-reader-action@v2
|
||||||
|
with:
|
||||||
|
version: ${{ steps.projectinfo.outputs.version }}
|
||||||
|
- name: Create a new tag and release
|
||||||
|
uses: ncipollo/release-action@v1
|
||||||
|
with:
|
||||||
|
tag: ${{ steps.changelog_reader.outputs.version }}
|
||||||
|
name: Release ${{ steps.changelog_reader.outputs.version }}
|
||||||
|
body: ${{ steps.changelog_reader.outputs.changes }}
|
||||||
|
allowUpdates: true
|
||||||
|
|
|
||||||
73
.github/workflows/pull-request.yml
vendored
73
.github/workflows/pull-request.yml
vendored
|
|
@ -3,8 +3,78 @@ name: Pull Request
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
types: [opened, edited, synchronize]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
lint-title:
|
||||||
|
name: Validate PR title
|
||||||
|
if: github.repository == 'KonradSzwarc/devscard'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: amannn/action-semantic-pull-request@v5
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
requireScope: false
|
||||||
|
|
||||||
|
version:
|
||||||
|
name: Check package.json version
|
||||||
|
if: github.repository == 'KonradSzwarc/devscard'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout PR branch
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
- name: Get project information
|
||||||
|
id: projectinfo-current
|
||||||
|
uses: gregoranders/nodejs-project-info@v0.0.19
|
||||||
|
- name: Checkout main branch
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.base.sha }}
|
||||||
|
- name: Get project information
|
||||||
|
id: projectinfo-main
|
||||||
|
uses: gregoranders/nodejs-project-info@v0.0.19
|
||||||
|
- name: Get next possible versions
|
||||||
|
id: semvers
|
||||||
|
uses: WyriHaximus/github-action-next-semvers@v1
|
||||||
|
with:
|
||||||
|
version: ${{ steps.projectinfo-main.outputs.version }}
|
||||||
|
- name: Assert correct version bump
|
||||||
|
uses: nick-fields/assert-action@v1
|
||||||
|
with:
|
||||||
|
expected: ${{ steps.projectinfo-current.outputs.version }}
|
||||||
|
actual: 'Possible version bumps: ${{ steps.semvers.outputs.patch }}, ${{ steps.semvers.outputs.minor }}, ${{ steps.semvers.outputs.major }}'
|
||||||
|
comparison: contains
|
||||||
|
|
||||||
|
changelog:
|
||||||
|
name: Check changelog
|
||||||
|
if: github.repository == 'KonradSzwarc/devscard'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Get project information
|
||||||
|
id: projectinfo
|
||||||
|
uses: gregoranders/nodejs-project-info@v0.0.19
|
||||||
|
- name: Enforce changelog update
|
||||||
|
uses: dangoslen/changelog-enforcer@v3
|
||||||
|
with:
|
||||||
|
expectedLatestVersion: ${{ steps.projectinfo.outputs.version }}
|
||||||
|
- name: Get changelog entries
|
||||||
|
id: changelog_reader
|
||||||
|
uses: mindsers/changelog-reader-action@v2
|
||||||
|
with:
|
||||||
|
version: ${{ steps.projectinfo.outputs.version }}
|
||||||
|
- name: Assert correct changelog version
|
||||||
|
uses: nick-fields/assert-action@v1
|
||||||
|
with:
|
||||||
|
expected: ${{ steps.projectinfo.outputs.version }}
|
||||||
|
actual: ${{ steps.changelog_reader.outputs.version }}
|
||||||
|
|
||||||
prettier:
|
prettier:
|
||||||
name: Run Prettier check
|
name: Run Prettier check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -50,6 +120,7 @@ jobs:
|
||||||
percy:
|
percy:
|
||||||
name: Run Percy check
|
name: Run Percy check
|
||||||
if: github.repository == 'KonradSzwarc/devscard'
|
if: github.repository == 'KonradSzwarc/devscard'
|
||||||
|
needs: [prettier, typescript, astro, lint-title, version, changelog]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
@ -70,7 +141,7 @@ jobs:
|
||||||
|
|
||||||
preview:
|
preview:
|
||||||
name: Create deploy preview
|
name: Create deploy preview
|
||||||
needs: [prettier, typescript, astro]
|
needs: [prettier, typescript, astro, lint-title, version, changelog]
|
||||||
if: github.repository == 'KonradSzwarc/devscard'
|
if: github.repository == 'KonradSzwarc/devscard'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
|
|
|
||||||
15
CHANGELOG.md
Normal file
15
CHANGELOG.md
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [0.0.1] - 2023-02-07
|
||||||
|
|
||||||
|
### Workflow
|
||||||
|
|
||||||
|
- ci: add `package.json` version and changelog check to PR workflow.
|
||||||
|
- ci: setup release workflow on the `main` branch.
|
||||||
|
|
||||||
|
### Docs
|
||||||
|
|
||||||
|
- docs: create changelog file.
|
||||||
|
- docs: add [contributing page](https://devscard.gitbook.io/docs/contributing).
|
||||||
|
|
@ -5,6 +5,10 @@
|
||||||
- [PDF generation](pdf-generation.md)
|
- [PDF generation](pdf-generation.md)
|
||||||
- [Data transformation](data-transformation.md)
|
- [Data transformation](data-transformation.md)
|
||||||
|
|
||||||
|
## Project development
|
||||||
|
|
||||||
|
- [Contributing](contributing.md)
|
||||||
|
|
||||||
## External links
|
## External links
|
||||||
|
|
||||||
- [Example resume](https://devscard.netlify.app)
|
- [Example resume](https://devscard.netlify.app)
|
||||||
|
|
|
||||||
68
docs/contributing.md
Normal file
68
docs/contributing.md
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
# Contributing
|
||||||
|
|
||||||
|
## PR workflow
|
||||||
|
|
||||||
|
### Maintainers
|
||||||
|
|
||||||
|
1. Create a pull request with a title matching the conventional commits convention.
|
||||||
|
2. Wait for all required checks to pass.
|
||||||
|
3. If you got a failing Percy check, it's okay as long as your PR was supposed to affect UI. Go to Percy's dashboard and review your visual changes.
|
||||||
|
4. Assign PR for one (or a few) of the maintainers.
|
||||||
|
5. Your PR is ready to merge when you have at least one approval and no unresolved threads.
|
||||||
|
6. Update the date in the changelog to be the current one.
|
||||||
|
7. Wait for checks to pass again and merge PR.
|
||||||
|
|
||||||
|
### Outside contributors
|
||||||
|
|
||||||
|
In progress...
|
||||||
|
|
||||||
|
## Versioning and changelog
|
||||||
|
|
||||||
|
As this project is used in a fork-based way, each merge to the `main` branch should contain the following:
|
||||||
|
|
||||||
|
- a version bump in `package.json`,
|
||||||
|
- a new entry in the `CHANGELOG.md`.
|
||||||
|
|
||||||
|
For the `CHANGELOG.md`, each update should look like follows:
|
||||||
|
|
||||||
|
```md
|
||||||
|
## [<version>] - <date>
|
||||||
|
|
||||||
|
**Related issue:** <issue-link>
|
||||||
|
|
||||||
|
### <affected>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Semantic versioning (\<version>)
|
||||||
|
|
||||||
|
Helps users to determine the changes made between their fork version and the recent version.
|
||||||
|
|
||||||
|
- Patch change (0.0.x) — bug fixes, refactors, docs, and dependency updates.
|
||||||
|
- Minor change (0.x.0) — features.
|
||||||
|
- Major change (x.0.0) — not used until we release a stable project version (1.0.0).
|
||||||
|
|
||||||
|
### Change date (\<date>)
|
||||||
|
|
||||||
|
Date when changes were merged written in YYYY-MM-DD format.
|
||||||
|
|
||||||
|
### Related issue (\<issue-link>)
|
||||||
|
|
||||||
|
If the changes are related to a particular issue, provide its URL.
|
||||||
|
|
||||||
|
### Affected components (\<affected>)
|
||||||
|
|
||||||
|
Determines what parts of the project were affected by changes.
|
||||||
|
|
||||||
|
- Docs — documentation updates.
|
||||||
|
- Dependencies — dependency updates.
|
||||||
|
- Workflow — changes in the development workflow.
|
||||||
|
- Web — changes related to the web version of the resume.
|
||||||
|
- Pdf — changes related to the pdf version of the resume.
|
||||||
|
- Schema — some optional schema properties were added.
|
||||||
|
- Schema (breaking) — some required schema properties were added, some properties were renamed/removed, data structure changed.
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
A short description of the changes you made. If your changes require some actions on project forks, remember to describe them.
|
||||||
12
package.json
12
package.json
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "devscard",
|
"name": "devscard",
|
||||||
"description": "Template for creating a comprehensive virtual CV for developers.",
|
"description": "Template for creating a comprehensive virtual CV for developers.",
|
||||||
"version": "0.0.0",
|
"version": "0.0.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14",
|
"node": ">=14",
|
||||||
|
|
@ -57,5 +57,13 @@
|
||||||
"ts-node": "10.9.1",
|
"ts-node": "10.9.1",
|
||||||
"type-fest": "3.5.5",
|
"type-fest": "3.5.5",
|
||||||
"typescript": "4.9.5"
|
"typescript": "4.9.5"
|
||||||
}
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/KonradSzwarc/devscard.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/KonradSzwarc/devscard/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/KonradSzwarc/devscard#readme"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue