-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (62 loc) · 2.13 KB
/
release-github.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: GitHub Release
on:
push:
tags:
- 'v*.*.*'
jobs:
release:
name: 'Tagged Release'
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.API_TOKEN_GITHUB }}
# Build process
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Set version to env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build package
run: |
yarn
npm pack
- name: Update CHANGELOG.md
id: changelog
run: |
yarn add --dev auto-changelog
npx auto-changelog
- name: Detect branch to commit changelog
id: branch-changelog
run: |
tagged_branches=$(git --no-pager branch -a --contains tags/${{ env.RELEASE_VERSION }} --no-column)
echo "$tagged_branches"
if echo "$tagged_branches" | grep -E '^[[:space:]]*main$' > /dev/null; then
commit_branch=main
elif echo "$tagged_branches" | grep -E '^[[:space:]]*main$' > /dev/null; then
commit_branch=main
elif echo "$tagged_branches" | grep -E '^[[:space:]]*develop$' > /dev/null; then
commit_branch=develop
else
commit_branch=$(echo "$tagged_branches" | tail -n1)
commit_branch=${commit_branch//[[:blank:]]/}
fi
commit_branch="${commit_branch//remotes\/origin\//}"
echo "COMMIT_BRANCH=${commit_branch}" >> $GITHUB_ENV
- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automated CHANGELOG.md update
commit_options: '--no-verify --signoff'
file_pattern: CHANGELOG.md
branch: ${{ env.COMMIT_BRANCH }}
- name: Publish Github relase
uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
prerelease: false
files: |
CHANGELOG.md
nevermined-io-payments-${{ env.RELEASE_VERSION }}.tgz