Skip to content

Commit 2ca560b

Browse files
Update, managed by Terraform
1 parent b595f8a commit 2ca560b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/release.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,49 @@
11
---
22
name: Release
33
on:
4+
pull_request:
5+
branches:
6+
- main
47
push:
58
branches:
69
- main
710

811
jobs:
12+
check:
13+
name: Check release
14+
runs-on: ubuntu-latest
15+
if: github.event_name == 'pull_request'
16+
steps:
17+
- name: Analyze commits
18+
id: next_release_version
19+
run: |
20+
npm install --save-dev semantic-release > /dev/null
21+
sed -i "s#const {isCi, branch, prBranch, isPr} = context.envCi;#const {isCi, branch, prBranch, isPr} = {isCi: false, branch: '${{ github.event.pull_request.head.ref }}', prBranch: undefined, isPr: undefined};#" node_modules/semantic-release/index.js
22+
echo ::set-output name=TAG::$(npx semantic-release -b ${{ github.event.pull_request.head.ref }} -p '@semantic-release/commit-analyzer' --dry-run --no-ci | grep -oiP 'the next release version is *\K.*')
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Create comment if analyze commits fails
27+
uses: peter-evans/create-or-update-comment@v1
28+
if: steps.next_release_version.outputs.TAG == ''
29+
with:
30+
issue-number: ${{ github.event.pull_request.number }}
31+
body: |
32+
Commits message format don't use Angular Commit Message Conventions and it's necessary to generate the next tag
33+
34+
https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines
35+
36+
- name: Cancel if analyze commits fails
37+
if: steps.next_release_version.outputs.TAG == ''
38+
uses: actions/github-script@v3
39+
with:
40+
script: |
41+
core.setFailed("Commits message format don't use Angular Commit Message Conventions and it's necessary to generate the next tag")
42+
943
release:
1044
name: Generate release
1145
runs-on: ubuntu-latest
46+
if: github.event_name == 'push'
1247
steps:
1348
- name: Checkout
1449
uses: actions/checkout@v2

0 commit comments

Comments
 (0)