Skip to content

Commit

Permalink
Rudimentary Release CI (#299)
Browse files Browse the repository at this point in the history
* dep: adding `release-it` dependency for automated releases

* ci: start to configure release-it

* ci: enhance github configuration

* ci: try to avoid recursive ci calls with release commits

* ci,git: working more on automatic relases in the commit messages

* ci: work on triggers for the release ci

* doc: document releases in the contributing md

* ci: first dry-run ci

* ci, refactor: shorten `QA` ci name

* ci: gaurd against names for the `step` variable

* ci, refactor: further improve if-triggers of release ci
  • Loading branch information
EagleoutIce committed Sep 15, 2023
1 parent ce3d007 commit 4e8a2d9
Show file tree
Hide file tree
Showing 7 changed files with 3,390 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .githooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ message_file = ARGV[0]
message = File.read(message_file)

# sloppy i know, but at least we have some guards
$regex = /^(\[(no|skip) ci\] )?(((feat|tests?|lint|refactor|ci|git|special|doc|typo|log|ts|fix|wip|docker|dep)(-fix|-fail)?(, ?)?)+: |Merge (remote-tracking )?branch|Auto-merging).+/
$regex = /^((\[(no|skip) ci\] )?(((feat|tests?|lint|refactor|ci|git|special|doc|typo|log|ts|fix|wip|docker|dep)(-fix|-fail)?(, ?)?)+: |Merge (remote-tracking )?branch|Auto-merging).+)|\[release:(patch|minor|major)\] .+/

if !$regex.match(message)
puts "[POLICY] Your message is not formatted correctly. Respect the regex: '#{$regex}'!"
Expand Down
38 changes: 21 additions & 17 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@ We structure our commit messages (enforced by our git-hooks) using the format `<
Currently, the following types are at your disposal (more may have been or are still available, but please restrict yourself to the following):


| name | description |
|:---------------|----------------------------------------------------------------------------------------------------|
| `feat` | Introduced a new feature. |
| `test`/`tests` | Introduced new or modified existing tests. |
| `refactor` | Represents a refactoring of existing code. |
| `ci` | Updated the ci pipeline of *flowR*. |
| `docker` | Regards the docker version of *flowR*. |
| `dep` | Regards the explicit update of dependencies. |
| `git` | Performed something git-specific (like updating the git-hooks). |
| `lint` | Adapted or updated linter-issues. |
| `doc` | Updated the documentation of *flowR*. |
| `typo` | Dealt with a small typo/a grammatical mistake. |
| `log` | Improved or updated the logging of *flowR*. |
| `ts` | Performed something typescript-specific (e.g., reconfigured the `tsconfig.json`). |
| `wip` | *Use this only in combination with another type*. It marks the commit to be unfinished. |
| `special` | *Use this only if none of the other categories apply*. Explain the details in your commit message. |

| name | description |
|:------------------------------------------------|----------------------------------------------------------------------------------------------------|
| `feat` | Introduced a new feature. |
| `test`/`tests` | Introduced new or modified existing tests. |
| `refactor` | Represents a refactoring of existing code. |
| `ci` | Updated the ci pipeline of *flowR*. |
| `docker` | Regards the docker version of *flowR*. |
| `dep` | Regards the explicit update of dependencies (or the addition of new dependencies. |
| `git` | Performed something git-specific (like updating the git-hooks). |
| `lint` | Adapted or updated linter-issues. |
| `doc` | Updated the documentation of *flowR*. |
| `typo` | Dealt with a small typo/a grammatical mistake. |
| `log` | Improved or updated the logging of *flowR*. |
| `ts` | Performed something typescript-specific (e.g., reconfigured the `tsconfig.json`). |
| `wip` | *Use this only in combination with another type*. It marks the commit to be unfinished. |
| `special` | *Use this only if none of the other categories apply*. Explain the details in your commit message. |

You can suffix each type with either

Expand All @@ -54,3 +53,8 @@ To skip the `ci`, you can prefix the commit message with `[skip ci]`.
## ToDo Comments

As indicated by [#238](https://github.com/Code-Inspect/flowr/issues/238) I decided to forbid `TODO`, `FIXME`, and `XXX` comments in code in favor of explicit *issues* directly on GitHub. Please do not try to get around that rule.

## Releases

Releases are to be scheduled by the administrators of the repository. Please do not try to create a release yourself.

2 changes: 1 addition & 1 deletion .github/workflows/check-broken-links.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: check for broken links
name: Check for Broken Links

'on':
push:
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "QA (and potentially deploy)"
name: "QA"
# Runs on each push and tests flowR for the default configuration
# Depending on the targets etc. this may perform many more checks!

Expand Down Expand Up @@ -64,10 +64,3 @@ jobs:
name: "Deploy Documentation (only on main)"
if: ${{ always() && !failure() && (inputs.force-full || (github.event_name == 'push' && github.ref == 'refs/heads/main')) }}
uses: Code-Inspect/flowr/.github/workflows/deploy-doc.yaml@main

deploy-docker:
needs: [ test, full-test ]
name: "Deploy Docker (only on main)"
if: ${{ always() && !failure() && (inputs.force-full || (github.event_name == 'push' && github.ref == 'refs/heads/main')) }}
uses: Code-Inspect/flowr/.github/workflows/deploy-docker.yaml@main
secrets: inherit
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Release"

'on':
push:
branches:
- main
workflow_dispatch:
# only currently so I can test in the ci

jobs:
release:
runs-on: ubuntu-latest
if: startsWith(github.event.head_commit.message, '[release:minor]') |
startsWith(github.event.head_commit.message, '[release:major]') |
startsWith(github.event.head_commit.message, '[release:patch]')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- run: npm ci
- run: |
msg="${{ github.event.head_commit.message }}"
step=$(echo "$msg" | sed -n 's/\[release:\(patch|minor|major\)].*/\1/p')
npm run release -- $step
deploy-docker:
needs: [ release ]
name: "Deploy Docker (only on main)"
if: startsWith(github.event.head_commit.message, '[release:minor]') |
startsWith(github.event.head_commit.message, '[release:major]') |
startsWith(github.event.head_commit.message, '[release:patch]')
uses: Code-Inspect/flowr/.github/workflows/deploy-docker.yaml@main
secrets: inherit
Loading

0 comments on commit 4e8a2d9

Please sign in to comment.