neon_arch
commited on
Commit
•
a301be7
1
Parent(s):
16d76bf
Create releases.yml
Browse files
.github/workflows/releases.yml
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Releases
|
2 |
+
on:
|
3 |
+
push:
|
4 |
+
branches:
|
5 |
+
- rolling
|
6 |
+
|
7 |
+
concurrency:
|
8 |
+
group: "main-branch"
|
9 |
+
|
10 |
+
jobs:
|
11 |
+
changelog:
|
12 |
+
if: github.repository == 'neon-mmd/websurfx '
|
13 |
+
runs-on: ubuntu-latest
|
14 |
+
|
15 |
+
steps:
|
16 |
+
# Create a temporary, uniquely named branch to push release info to
|
17 |
+
- name: create temporary branch
|
18 |
+
uses: peterjgrainger/action-create-branch@v2.3.0
|
19 |
+
id: create-branch
|
20 |
+
with:
|
21 |
+
branch: "release-from-${{ github.sha }}"
|
22 |
+
sha: "${{ github.sha }}"
|
23 |
+
env:
|
24 |
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
25 |
+
|
26 |
+
# check out the repository afterwards
|
27 |
+
- uses: actions/checkout@v3
|
28 |
+
|
29 |
+
# fetch branches and switch to the temporary branch
|
30 |
+
- name: switch to new branch
|
31 |
+
run: git fetch --all && git checkout --track origin/release-from-${{ github.sha }}
|
32 |
+
|
33 |
+
# update app config with version
|
34 |
+
- name: get-npm-version
|
35 |
+
id: package-version
|
36 |
+
uses: martinbeentjes/npm-get-version-action@master
|
37 |
+
- name: update app config
|
38 |
+
run: sed -i 's/0.0.0/${{ steps.package-version.outputs.current-version}}/g' config/app.json
|
39 |
+
|
40 |
+
# create release info and push it upstream
|
41 |
+
- name: conventional Changelog Action
|
42 |
+
id: changelog
|
43 |
+
uses: TriPSs/conventional-changelog-action@v3
|
44 |
+
with:
|
45 |
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
46 |
+
version-file: "./package.json,./package-lock.json,./config/app.json"
|
47 |
+
git-branch: "release-from-${{ github.sha }}"
|
48 |
+
skip-on-empty: false
|
49 |
+
skip-git-pull: true
|
50 |
+
|
51 |
+
# create PR using GitHub CLI
|
52 |
+
- name: create PR with release info
|
53 |
+
id: create-pr
|
54 |
+
run: gh pr create --base main --head release-from-${{ github.sha }} --title 'Merge new release into main' --body 'Created by Github action'
|
55 |
+
env:
|
56 |
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
57 |
+
|
58 |
+
# merge PR using GitHub CLI
|
59 |
+
- name: merge PR with release info
|
60 |
+
id: merge-pr
|
61 |
+
run: gh pr merge --admin --merge --subject 'Merge release info' --delete-branch
|
62 |
+
env:
|
63 |
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
64 |
+
|
65 |
+
# release info is now in main so we can continue as before
|
66 |
+
- name: create release with last commit
|
67 |
+
uses: actions/create-release@v1
|
68 |
+
if: steps.changelog.outputs.skipped == 'false'
|
69 |
+
env:
|
70 |
+
GITHUB_TOKEN: ${{ secrets.CHANGELOG_RELEASE }}
|
71 |
+
with:
|
72 |
+
tag_name: ${{ steps.changelog.outputs.tag }}
|
73 |
+
release_name: ${{ steps.changelog.outputs.tag }}
|
74 |
+
body: ${{ steps.changelog.outputs.clean_changelog }}
|