Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 409147f

Browse files
authored
feat: release action
1 parent e56e4d8 commit 409147f

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
changelog:
9+
if: github.repository == 'EddieHubCommunity/EddieHubCommunity.github.io'
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
# check out the repository with all releases
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
# Create a temporary, uniquely named branch to push release info to
19+
- name: create temporary branch
20+
run: git branch "release-from-${{ github.sha }}" "${{ github.sha }}"
21+
22+
# switch to the temporary branch
23+
- name: switch to new branch
24+
run: git checkout release-from-${{ github.sha }}
25+
26+
# create release info and push it upstream
27+
- name: conventional Changelog Action
28+
id: changelog
29+
uses: TriPSs/conventional-changelog-action@v3
30+
with:
31+
github-token: ${{ secrets.GITHUB_TOKEN }}
32+
version-file: "./package.json,./package-lock.json,./src/config/app.json"
33+
git-branch: "release-from-${{ github.sha }}"
34+
skip-git-pull: true
35+
36+
# create PR using GitHub CLI
37+
- name: create PR with release info
38+
if: steps.changelog.outputs.skipped == 'false'
39+
id: create-pr
40+
run: gh pr create --base main --head release-from-${{ github.sha }} --title 'Merge new release into main' --body 'Created by Github action'
41+
env:
42+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
44+
# merge PR using GitHub CLI
45+
- name: merge PR with release info
46+
if: steps.changelog.outputs.skipped == 'false'
47+
id: merge-pr
48+
run: gh pr merge --admin --merge --subject 'Merge release info' --delete-branch
49+
env:
50+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
52+
# release info is now in main so we can continue as before
53+
- name: create release with last commit
54+
if: steps.changelog.outputs.skipped == 'false'
55+
uses: ncipollo/release-action@v1
56+
with:
57+
token: ${{ secrets.CHANGELOG_RELEASE }}
58+
tag: ${{ steps.changelog.outputs.tag }}
59+
name: ${{ steps.changelog.outputs.tag }}
60+
body: ${{ steps.changelog.outputs.clean_changelog }}

0 commit comments

Comments
 (0)