Skip to content

Commit

Permalink
Full Release on Continuous Delivery (#49) (#50)
Browse files Browse the repository at this point in the history
### Changes
 * Added pull_request_style_check.yml to check for PR labels.
 * Added release_draft.yml to draft a release on each push to develop.
 * Updated continuous_delivery.yml to publish the release named draft.
 * Added release-drafter.yml to configure the output of the release drafter change log.
  • Loading branch information
shaharbar1 authored Sep 4, 2024
1 parent fcd0896 commit 718d35c
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 4 deletions.
17 changes: 17 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name-template: 'Draft'
template: |
# What's Changed
$CHANGES
categories:
- title: '🚀 Features'
label: 'enhancement'
- title: '🐛 Bug Fixes'
label: 'bug'
- title: '📝 Documentation'
label: 'documentation'
collapse-after: 5

exclude-labels:
- 'skip-changelog'
35 changes: 31 additions & 4 deletions .github/workflows/continuous_delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ jobs:
- name: Extract version from pyproject.toml
id: extract_version
run: |
VERSION=$(poetry version -s)
VERSION=v$(poetry version -s)
echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_ENV
- name: Verify if version has changed
id: version_check
run: |
if [ $(git tag -l "v${{ env.PACKAGE_VERSION }}") ]; then
if [ $(git tag -l ${{ env.PACKAGE_VERSION }}") ]; then
echo "Version ${{ env.PACKAGE_VERSION }} already exists."
exit 0
fi
Expand All @@ -58,5 +58,32 @@ jobs:
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
git tag "v${{ env.PACKAGE_VERSION }}"
git push origin "v${{ env.PACKAGE_VERSION }}"
git tag "${{ env.PACKAGE_VERSION }}"
git push origin "${{ env.PACKAGE_VERSION }}"
- name: Publish Draft Release
if: ${{ success() && matrix.python-version == 3.8 }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: releases } = await github.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
});
const draftRelease = releases.find(r => r.draft && r.name === 'Draft');
if (draftRelease) {
await github.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: draftRelease.id,
tag_name: process.env.PACKAGE_VERSION,
name: process.env.PACKAGE_VERSION,
draft: false
});
} else {
core.setFailed(`Draft release named "Draft" not found.`);
};
env:
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
24 changes: 24 additions & 0 deletions .github/workflows/pull_request_style_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Pull Request Style Check

on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
- edited
branches:
- develop


jobs:
check_cc_labels:
name: check conventional commits labels
runs-on: ubuntu-latest
steps:
- uses: danielchabr/[email protected]
with:
hasSome: bug, documentation, enhancement
githubToken: ${{ secrets.GITHUB_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/release_draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Release Draft

on:
push:
branches:
- develop

jobs:
draft_release:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Draft a new release
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 718d35c

Please sign in to comment.