-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (46 loc) · 1.2 KB
/
tests.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
name: 🧪 Tests
on:
push:
paths-ignore:
- 'CODE_OF_CONDUCT`'
- 'LICENSE'
- 'README.md'
branches:
- main
tags:
- v[0-9].[0-9].[0-9]
- v[0-9].[0-9].[0-9]-uat.[0-9]
pull_request:
paths-ignore:
- 'CODE_OF_CONDUCT`'
- 'LICENSE'
- 'README.md'
branches:
- main
concurrency:
group: '${{ github.workflow }} @ ${{ github.ref }}'
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: 💻 Checkout current code ref
uses: actions/checkout@v4
- name: 📝 Set ENVIRONMENT
id: env
uses: ./
- name: Check ENVIRONMENT matches expected value
run: |
if [[ "$GITHUB_REF_NAME" =~ ^v([0-9].[0-9].[0-9])$ ]]; then
if [[ ${{ steps.env.outputs.environment }} != 'production' ]]; then
exit 1;
fi
elif [[ "$GITHUB_REF_NAME" =~ ^v([0-9].[0-9].[0-9])(-uat.[0-9]{1,2})$ ]]; then
if [[ ${{ steps.env.outputs.environment }} != 'uat' ]]; then
exit 1;
fi
else
if [[ ${{ steps.env.outputs.environment }} != 'stage' ]]; then
exit 1;
fi
fi