-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (54 loc) · 2.31 KB
/
publish-new-github-release.yml
File metadata and controls
61 lines (54 loc) · 2.31 KB
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
name: Publish new github release
on:
pull_request:
branches:
- master
types:
- closed
jobs:
release:
name: Publish new release
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.head.ref, 'release/') && github.event.pull_request.merged == true # only merged pull requests must trigger this job
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
with:
egress-policy: audit
- name: Extract version from branch name (for release branches)
id: extract-version
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#hotfix-}
VERSION=${VERSION#release/}
echo "release_version=$VERSION" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 16
# In order to make a commit, we need to initialize a user.
# You may choose to write something less generic here if you want, it doesn't matter functionality wise.
- name: Initialize mandatory git config
run: |
git config user.name "GitHub actions"
git config user.email noreply@github.com
- name: Create Github Release & tag
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.PAT }}
run: |
git tag -a v${{ steps.extract-version.outputs.release_version }} -m "chore: release v${{ steps.extract-version.outputs.release_version }}"
git push origin refs/tags/v${{ steps.extract-version.outputs.release_version }}
DEBUG=conventional-github-releaser npx conventional-github-releaser -p angular
- name: Delete release branch
uses: koj-co/delete-merged-action@63a03c35810a8a7d4840d18793c0f68ff8b59450 # master
if: startsWith(github.event.pull_request.head.ref, 'release/')
with:
branches: 'release/*'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}