Skip to content

Commit

Permalink
💚 Adds release gh-action
Browse files Browse the repository at this point in the history
This commit adds a release github action. It further updates the
bumpversion config file and the README.md.
  • Loading branch information
rickstaa committed Jan 11, 2021
1 parent 4ed3c94 commit b0b7b1d
Show file tree
Hide file tree
Showing 8 changed files with 186 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ message = :bookmark: Bump version: {current_version} → {new_version}
tag = True

[bumpversion:file:simzoo/version.py]

[bumpversion:file:setup.cfg]
[bumpversion:file:package.json]
File renamed without changes.
32 changes: 32 additions & 0 deletions .github/workflows/release-changelog-builder-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"categories": [
{
"title": "## 🚀 Features",
"labels": ["feature"]
},
{
"title": "## 🐛 Fixes",
"labels": ["fix"]
},
{
"title": "## 🧪 Tests",
"labels": ["test"]
},
{
"title": "## 📝 Tests",
"labels": ["docs"]
},
{
"title": "## 💚 CI",
"labels": ["CI"]
},
{
"title": "## 🔒 Security",
"labels": ["security"]
},
{
"title": "## 🔄 Dependency updates",
"labels": ["dependencies"]
}
]
}
124 changes: 124 additions & 0 deletions .github/workflows/release_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Github action that makes sure that all the version tags are up to date when
# A new version tag is added.
name: Ex3_ekf release CI
on:
push:
tags:
- v*.*.*
jobs:
update-code-version:
runs-on: ubuntu-latest
if: github.event.action != 'labeled'
steps:
# NOTE: Updates the version that is specified in the code files.
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Get current semver tag
id: get_semver
uses: rickstaa/action-get-semver@v1
with:
verbose: "true"
# Use bumpversion to update version in code
# See. https://pypi.org/project/bump2version/
- name: Set up Python environment
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Cache python environment
uses: actions/cache@v2
id: cache-python-env
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('setup.cfg') }}-${{ hashFiles('pyproject.toml') }}-bumpversion
- name: Update pip
if: steps.cache-python-env.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
- name: Install bump2version
if: steps.cache-python-env.outputs.cache-hit != 'true'
run: |
pip install bump2version
- name: Make sure the version in all code files is correct
run: |
bumpversion --no-tag --no-commit --new-version ${{ steps.get_semver.outputs.current_version }} patch
- name: Commit code version changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: ":bookmark: Updates documentation version to ${{ steps.get_semver.outputs.current_version }}"
release-changelog:
runs-on: ubuntu-latest
needs: update-code-version
if: github.event.action != 'labeled'
steps:
# NOTE: Makes sure the changelog is up to date.
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: "12"
- name: Install auto-changelog
run: npm install
- name: Create CHANGELOG.md file using auto-changelog
run: npm run auto-changelog
- name: Commit changelog changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: ":memo: Updates CHANGELOG.md"
move-semver-tags:
runs-on: ubuntu-latest
needs: release-changelog
if: github.event.action != 'labeled'
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0
- name: Get latest semver tag
id: get_semver
uses: rickstaa/action-get-semver@v1
with:
verbose: "true"
- name: Updates major and minor version tags
uses: rickstaa/action-update-semver@v1
with:
tag: "${{ steps.get_semver.outputs.current_version }}"
create-pre-release:
# NOTE: Creates a pre-release for the new tag
runs-on: ubuntu-latest
needs: move-semver-tags
if: github.event.action != 'labeled'
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0
- name: Get latest semver tag
id: get_semver
uses: rickstaa/action-get-semver@v1
with:
verbose: "true"
- name: Build release changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@main
env:
configuration: ".github/workflows/release-changelog-builder-config.json"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create pre-release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.get_semver.outputs.current_version }}
release_name: ${{ steps.get_semver.outputs.current_version }}
body: ${{ steps.build_changelog.outputs.changelog }}
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "Simzoo",
"version": "0.2.2",
"repository": {
"type": "git",
"url": "[email protected]:rickstaa/simzoo.git"
},
"license": "UNLICENSED",
"devDependencies": {
"auto-changelog": "^2.2.1"
},
"scripts": {
"auto-changelog": "auto-changelog -p && git add CHANGELOG.md"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false
}
}
6 changes: 6 additions & 0 deletions simzoo/envs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# envs

This folder contains the following submodules:

- [ex3_ekf](https://github.com/rickstaa/ex3-ekf):A gym environment for a noisy master-slave system.
- [oscillator](https://github.com/rickstaa/oscillator):A gym environment for a synthetic oscillatory network of transcriptional regulators called a repressilator.
2 changes: 1 addition & 1 deletion simzoo/envs/ex3_ekf
2 changes: 1 addition & 1 deletion simzoo/envs/oscillator

0 comments on commit b0b7b1d

Please sign in to comment.