Skip to content

Commit 6c07dc2

Browse files
Merge pull request #418 from AbsaOSS/feature/417-Set-up-workflows-for-automatic-repository-release
#4 17 - Set up workflows for automatic repository release
2 parents 0dcf728 + 488281a commit 6c07dc2

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check PR Release Notes in Description
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, edited, labeled, unlabeled]
6+
branches: [ master ]
7+
8+
jobs:
9+
check-release-notes:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/[email protected]
14+
with:
15+
python-version: '3.11'
16+
17+
- name: Check presence of release notes in PR description
18+
uses: AbsaOSS/[email protected]
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
with:
22+
github-repository: ${{ github.repository }}
23+
pr-number: ${{ github.event.number }}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Release - create draft release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
tag-name:
6+
description: 'Name of git tag to be created, and then draft release created. Syntax: "v[0-9]+.[0-9]+.[0-9]+".'
7+
required: true
8+
from-tag-name:
9+
description: 'Name of the git tag from which to detect changes from. Default value: latest tag. Syntax: "v[0-9]+.[0-9]+.[0-9]+".'
10+
required: false
11+
12+
jobs:
13+
release-draft:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
persist-credentials: false
20+
21+
- uses: actions/[email protected]
22+
with:
23+
python-version: '3.11'
24+
25+
- name: Check format of received tag
26+
id: check-version-tag
27+
uses: AbsaOSS/[email protected]
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
with:
31+
github-repository: ${{ github.repository }}
32+
version-tag: ${{ github.event.inputs.tag-name }}
33+
34+
- name: Check format of received from tag
35+
if: ${{ github.event.inputs.from-tag-name }}
36+
id: check-version-from-tag
37+
uses: AbsaOSS/[email protected]
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
with:
41+
github-repository: ${{ github.repository }}
42+
version-tag: ${{ github.event.inputs.from-tag-name }}
43+
should-exist: true
44+
45+
- name: Generate Release Notes
46+
id: generate_release_notes
47+
uses: AbsaOSS/[email protected]
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
with:
51+
tag-name: ${{ github.event.inputs.tag-name }}
52+
from-tag-name: ${{ github.event.inputs.from-tag-name }}
53+
chapters: |
54+
- { title: No entry 🚫, label: duplicate }
55+
- { title: Breaking Changes 💥, label: breaking-change }
56+
- { title: New Features 🎉, label: enhancement }
57+
- { title: New Features 🎉, label: feature }
58+
- { title: Bugfixes 🛠, label: bug }
59+
- { title: Infrastructure ⚙️, label: infrastructure }
60+
- { title: Silent-live 🤫, label: silent-live }
61+
- { title: Documentation 📜, label: documentation }
62+
warnings: true
63+
64+
- name: Create and Push Tag
65+
uses: actions/github-script@v7
66+
with:
67+
script: |
68+
const tag = core.getInput('tag-name')
69+
const ref = `refs/tags/${tag}`;
70+
const sha = context.sha; // The SHA of the commit to tag
71+
72+
await github.rest.git.createRef({
73+
owner: context.repo.owner,
74+
repo: context.repo.repo,
75+
ref: ref,
76+
sha: sha
77+
});
78+
79+
console.log(`Tag created: ${tag}`);
80+
github-token: ${{ secrets.GITHUB_TOKEN }}
81+
tag-name: ${{ github.event.inputs.tag-name }}
82+
83+
- name: Create Draft Release
84+
uses: softprops/action-gh-release@v1
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
with:
88+
name: ${{ github.event.inputs.tag-name }}
89+
body: ${{ steps.generate_release_notes.outputs.release-notes }}
90+
tag_name: ${{ github.event.inputs.tag-name }}
91+
draft: true
92+
prerelease: false

0 commit comments

Comments
 (0)