Skip to content

Commit 228069a

Browse files
authored
Replace local script by OpenTermsArchive/changelog-action (#51)
2 parents ef5067a + 3a6c435 commit 228069a

File tree

3 files changed

+54
-58
lines changed

3 files changed

+54
-58
lines changed

.github/workflows/changelog.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
name: Check changelog
1+
name: Changelog
22

33
on:
4-
push:
5-
branches-ignore:
6-
- main
7-
- push-action/** # Temporary branches created by CasperWA/push-protected@v2 action on release workflow
84
pull_request:
9-
types: [ opened, reopened ]
5+
workflow_dispatch:
106
workflow_call:
117
outputs:
12-
release_type:
8+
release-type:
139
description: The release type extracted from changelog
14-
value: ${{ jobs.check_changelog.outputs.release_type }}
10+
value: ${{ jobs.validate.outputs.release-type }}
1511

1612
jobs:
17-
check_changelog:
18-
uses: OpenTermsArchive/engine/.github/workflows/[email protected]
13+
validate:
14+
runs-on: [ ubuntu-latest ]
15+
outputs:
16+
release-type: ${{ steps.validate-changelog.outputs.release-type }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Validate changelog
21+
id: validate-changelog
22+
uses: OpenTermsArchive/manage-changelog/[email protected]

.github/workflows/release.yml

Lines changed: 36 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,64 +6,42 @@ on:
66
- main
77
types: [ closed ]
88

9-
109
jobs:
1110
changelog:
1211
uses: ./.github/workflows/changelog.yml
1312
release:
14-
if: github.event.pull_request.merged == true
13+
if: needs.changelog.outputs.release-type != 'no-release'
1514
needs: [ changelog ]
1615
runs-on: ubuntu-latest
1716
steps:
1817
- name: Checkout
19-
uses: actions/checkout@v2
18+
uses: actions/checkout@v4
2019
with:
2120
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
2221

2322
- name: Configure Git author
2423
run: |
2524
git config --global user.name "Open Terms Archive Release Bot"
2625
git config --global user.email "[email protected]"
27-
28-
- name: Install Semver
29-
run: npm i -g semver
30-
31-
- name: Get current version
32-
id: get_current_version
33-
uses: mikefarah/yq@master
34-
with:
35-
cmd: yq '.version' galaxy.yml
3626
37-
- name: Bump version
38-
run: |
39-
echo "Found release type '${{ env.RELEASE_TYPE }}'"
40-
echo "NEW_VERSION=$(semver -i $RELEASE_TYPE ${{ steps.get_current_version.outputs.result }})" >> $GITHUB_ENV
41-
env:
42-
RELEASE_TYPE: ${{ needs.changelog.outputs.release_type }}
43-
44-
- name: Update changelog unreleased section with new version
45-
uses: superfaceai/release-changelog-action@v2
46-
with:
47-
path-to-changelog: CHANGELOG.md
48-
version: ${{ env.NEW_VERSION }}
49-
operation: release
50-
format: markdownlint
27+
- name: Update changelog for release
28+
id: release-changelog
29+
uses: OpenTermsArchive/manage-changelog/[email protected]
5130

5231
- name: Build Collection
5332
uses: artis3n/ansible_galaxy_collection@v2
5433
with:
5534
api_key: '${{ secrets.GALAXY_API_KEY }}'
56-
galaxy_version: '${{ env.NEW_VERSION }}'
35+
galaxy_version: '${{ steps.release-changelog.outputs.version }}'
5736
build: true
5837
publish: false
5938

60-
- name: Commit CHANGELOG.md and create tag
39+
- name: Commit CHANGELOG.md and galaxy.yml changes and create tag
6140
run: |
62-
git add "CHANGELOG.md"
63-
git add "galaxy.yml"
64-
git commit -m "Release ${{ env.NEW_VERSION }}"
65-
git tag ${{ env.NEW_VERSION }}
66-
41+
git add "CHANGELOG.md" "galaxy.yml"
42+
git commit -m "Release ${{ steps.release-changelog.outputs.version }}"
43+
git tag v${{ steps.release-changelog.outputs.version }}
44+
6745
- name: Run status checks for release commit on temporary branch # Use temporary branch to enable pushing commits to this branch protected by required status checks
6846
uses: CasperWA/push-protected@v2
6947
with:
@@ -73,24 +51,13 @@ jobs:
7351

7452
- name: Push changes to repository
7553
run: git push origin && git push --tags
76-
env:
77-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78-
79-
- name: Read version changelog
80-
uses: superfaceai/release-changelog-action@v2
81-
id: get-changelog
82-
with:
83-
path-to-changelog: CHANGELOG.md
84-
version: ${{ env.NEW_VERSION }}
85-
operation: read
8654

87-
- name: Update GitHub release with changelog
55+
- name: Create GitHub release
8856
uses: softprops/action-gh-release@v1
8957
with:
90-
tag_name: ${{ env.NEW_VERSION }}
91-
body: ${{ steps.get-changelog.outputs.changelog }}
92-
env:
93-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
tag_name: v${{ steps.release-changelog.outputs.version }}
59+
body: ${{ steps.release-changelog.outputs.content }}
60+
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
9461

9562
- name: Publish Collection on Ansible Galaxy
9663
uses: artis3n/ansible_galaxy_collection@v2
@@ -99,3 +66,24 @@ jobs:
9966
build: false
10067
publish: true
10168

69+
clean_changelog:
70+
if: needs.changelog.outputs.release-type == 'no-release'
71+
needs: [ changelog ]
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v4
75+
with:
76+
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
77+
78+
- name: Configure Git author
79+
run: |
80+
git config --global user.name "Open Terms Archive Release Bot"
81+
git config --global user.email "[email protected]"
82+
83+
- name: Update changelog for release
84+
uses: OpenTermsArchive/manage-changelog/[email protected]
85+
86+
- name: Erase unreleased information from changelog
87+
run: |
88+
git commit -m "Clean changelog" CHANGELOG.md
89+
git push origin

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5+
## Unreleased [no-release]
6+
7+
_Modifications made in this changeset do not add, remove or alter any behavior, dependency, API or functionality of the software. They only change non-functional parts of the repository, such as the README file or CI workflows._
8+
59
## Unreleased
610

711
## 2.0.2 - 2024-06-12

0 commit comments

Comments
 (0)