This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
98 lines (81 loc) · 3.12 KB
/
action.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Creates a Pre-Release Release Candidate Github Tag
# and Release when PR is merged/closed to develop
# This workflow triggers only for changes in projects mentioned inside paths[]
# Use PR label
# norelease - when you do not want to release rc candidate but want to merge
name: Release Candidate
inputs:
repo-link: # id of input
description: 'what is the link for the repo: ie. https://api.github.com/repos/tajawal/almosafer-business/'
required: true
node-version: # id of input
description: 'which node version to use?'
required: false
default: '16.14'
runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ inputs.node-version }}
- name: Install npm dependencies
run: npm ci
shell: bash
- name: Set git user
run: git config user.name seera-frontend && git config user.email seera-frontend@seera.sa
shell: bash
- name: Disable develop Protection
run: |
curl --location --request PUT '${{ inputs.repo-link }}/branches/develop/protection' \
--header 'Authorization: token ${{ secrets.SEERA_FRONTEND_TOKEN }}' \
--header 'Content-Type: application/json' \
--data-raw '{ "required_pull_request_reviews": null, "required_status_checks": null, "enforce_admins": null,"restrictions": null }'
shell: bash
- name: Default Release
id: defaultReleaseStep
run: echo "RELEASE_TYPE=patch" >> $GITHUB_ENV
shell: bash
- name: Release Type
id: releaseTypeStep
run: |
if [[ ${{ contains(github.event.pull_request.labels.*.name, 'patch') }} = "true" ]]; then
echo "RELEASE_TYPE=patch" >> $GITHUB_ENV
fi
if [[ ${{ contains(github.event.pull_request.labels.*.name, 'minor') }} = "true" ]]; then
echo "RELEASE_TYPE=minor" >> $GITHUB_ENV
fi
if [[ ${{ contains(github.event.pull_request.labels.*.name, 'major') }} = "true" ]]; then
echo "RELEASE_TYPE=major" >> $GITHUB_ENV
fi
shell: bash
- name: Release RC Tag
run: npm run release:rc $RELEASE_TYPE
shell: bash
id: releaseStep
env:
GITHUB_TOKEN: ${{ secrets.SEERA_FRONTEND_TOKEN }}
- name: Get develop branch tag
run: echo "DEVELOP_TAG=$(echo $(git describe --tags --abbrev=0))" >> $GITHUB_ENV
shell: bash
- name: Github Release
run: gh release create $DEVELOP_TAG --target develop --prerelease --title $DEVELOP_TAG
id: releaseStep
env:
GITHUB_TOKEN: ${{ secrets.SEERA_FRONTEND_TOKEN }}
shell: bash
- name: Enable develop Protection
run: |
curl --location --request PATCH '${{ inputs.repo-link }}/branches/develop/protection/required_pull_request_reviews' \
--header 'Authorization: token ${{ secrets.SEERA_FRONTEND_TOKEN }}' \
--header 'Content-Type: application/json' \
--data-raw '{}'
shell: bash
# Ref: https://haya14busa.github.io/github-action-brandings/
branding:
icon: 'check'
color: 'blue'