Skip to content

Commit

Permalink
ci: setup release workflow (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
KonradSzwarc authored Feb 8, 2023
1 parent ec53471 commit b21daf0
Show file tree
Hide file tree
Showing 7 changed files with 193 additions and 30 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/lint-pr-title.yml

This file was deleted.

25 changes: 24 additions & 1 deletion .github/workflows/main-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ jobs:
percy:
name: Run Percy check
if: github.repository == 'KonradSzwarc/devscard'
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -111,3 +110,27 @@ jobs:
with:
urls: ${{ needs.deploy.outputs.deploy-url }}
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/[email protected]
- 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 changes: 72 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,78 @@ name: Pull Request
on:
pull_request:
branches: [main]
types: [opened, edited, synchronize]

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/[email protected]
- 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/[email protected]
- 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/[email protected]
- 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:
name: Run Prettier check
runs-on: ubuntu-latest
Expand Down Expand Up @@ -50,6 +120,7 @@ jobs:
percy:
name: Run Percy check
if: github.repository == 'KonradSzwarc/devscard'
needs: [prettier, typescript, astro, lint-title, version, changelog]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -70,7 +141,7 @@ jobs:

preview:
name: Create deploy preview
needs: [prettier, typescript, astro]
needs: [prettier, typescript, astro, lint-title, version, changelog]
if: github.repository == 'KonradSzwarc/devscard'
runs-on: ubuntu-latest
outputs:
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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).
4 changes: 4 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- [PDF generation](pdf-generation.md)
- [Data transformation](data-transformation.md)

## Project development

- [Contributing](contributing.md)

## External links

- [Example resume](https://devscard.netlify.app)
Expand Down
68 changes: 68 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "devscard",
"description": "Template for creating a comprehensive virtual CV for developers.",
"version": "0.0.0",
"version": "0.0.1",
"private": true,
"engines": {
"node": ">=14",
Expand Down Expand Up @@ -57,5 +57,13 @@
"ts-node": "10.9.1",
"type-fest": "3.5.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"
}

1 comment on commit b21daf0

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.