Skip to content

Commit

Permalink
DX: import deployment workflows (#6)
Browse files Browse the repository at this point in the history
* DX: add release drafter
* DX: add PR linting
* DX: add CD workflow for pushing to version branches
  • Loading branch information
redeboer authored Mar 12, 2024
1 parent a1fdf75 commit c757859
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name-template: update-pip-constraints $NEXT_PATCH_VERSION
tag-template: $NEXT_PATCH_VERSION

references:
- main
- epic/*

categories:
- title: ✨ New features
label: ✨ Feature
- title: ⚠️ Enhancements and optimizations
label: ⚙️ Enhancement
- title: ⚠️ API changes
label: ⚠️ Interface
- title: ⚠️ Changes that may affect behavior
label: ❗ Behavior
- title: 🐛 Bug fixes
label: 🐛 Bug
- title: 📝 Documentation
label: 📝 Docs
- title: 🔨 Maintenance
label: 🔨 Maintenance
- title: 🖱️ Developer Experience
label: 🖱️ DX

change-template: "- $TITLE (#$NUMBER)"

replacers:
- search: /([A-Z]+!?:\s*)(.*)/g
replace: $2

sort-direction: ascending

template: |
$CHANGES
_The full changelog as commits can be found [here](https://github.com/ComPWA/update-pip-constraints/compare/$PREVIOUS_TAG...$NEXT_PATCH_VERSION)._
33 changes: 33 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CD

on:
release:
types:
- prereleased
- released

jobs:
milestone:
if: startsWith(github.ref, 'refs/tags')
uses: ComPWA/actions/.github/workflows/close-milestone.yml@v1
push-to-version-branches:
name: Push to version branches
if: startsWith(github.ref, 'refs/tags') && !github.event.release.prerelease
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Configure Git credentials
run: |
git config --global user.name "GitHub Action"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Push to matching minor version branch
env:
TAG: ${{ github.ref_name }}
run: |
re='^(v?)([0-9]+)\.([0-9]+)\.[0-9]+'
if [[ $TAG =~ $re ]]; then
MAJOR_VERSION="${BASH_REMATCH[2]}"
MINOR_VERSION="${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
git push origin HEAD:refs/heads/v$MAJOR_VERSION --force
git push origin HEAD:refs/heads/v$MINOR_VERSION --force
fi
33 changes: 33 additions & 0 deletions .github/workflows/pr-linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: PR linting
on:
pull_request:
types:
- edited
- labeled
- opened
- reopened
- synchronize
- unlabeled

jobs:
check-labels:
name: Check labels
runs-on: ubuntu-22.04
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
any_of: >-
🐛 Bug,✨ Feature,⚙️ Enhancement,⚠️ Interface,❗ Behavior,📝 Docs,🔨 Maintenance,🖱️ DX
none_of: Epic,💫 Good first issue
repo_token: ${{ secrets.GITHUB_TOKEN }}

check-title:
name: Check title
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- run: npm install @compwa/commitlint-config
- name: Create commitlint config
run: |
echo "module.exports = {extends: ['@compwa/commitlint-config']}" > commitlint.config.js
- uses: JulienKode/[email protected]
16 changes: 16 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Drafter

on:
push:
branches:
- main
- epic/*
workflow_dispatch:

jobs:
update_release_draft:
runs-on: ubuntu-22.04
steps:
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit c757859

Please sign in to comment.