forked from iamtheyammer/branch-env-vars
-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (55 loc) · 2.1 KB
/
action-test.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
name: Action Test
on: [push, pull_request]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Read nodejs version from package.json
run: |
echo "NODE_VERSION=$(node -p -e "require('./package.json').engines.node")" >> $GITHUB_ENV
- name: Setup Node.js version ${{ env.PROJECT_NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.PROJECT_NODE_VERSION }}
- name: Install dependencies and compile code
run: |
npm ci
npm run build
- name: Set some branch-based environment variables
uses: ./
with:
KITCHEN_SINK: |
master:value for KITCHEN_SINK on the master branch
test-branch:value for KITCHEN_SINK on test-branch
!pr:KITCHEN_SINK value for a pull request
!pr|master:value for master PR
release_candidate_*:KITCHEN_SINK Release Candidate
!tag:KITCHEN_SINK value for a tag
!default:default value for KITCHEN_SINK
COMMENT_EMPTY_LINE_TEST: |
!default:COMMENT_EMPTY_LINE_TEST
# this is a comment
# those are some empty, empty lines
SECRET_TEST: |
master:${{ secrets.TEST_SECRET }}
!default:${{ secrets.TEST_SECRET}} but its default
STATIC_TEST: 'just a static env var here'
MASTER_PR: |
!pr|master:value for master PR
!default:default value for MASTER_PR
TRIM_TEST: |
branch-pr :value for branch-pr PR (trim)
master :value for master merge (trim)
!default:default value for MASTER_PR
!pr|master :value for master PR (trim)
- name: Print out those variables!
run: |
echo "KITCHEN_SINK: $KITCHEN_SINK"
echo "COMMENT_EMPTY_LINE_TEST: $COMMENT_EMPTY_LINE_TEST"
echo "SECRET_TEST: $SECRET_TEST"
echo "STATIC_TEST: $STATIC_TEST"
echo "MASTER_PR: $MASTER_PR"
echo "TRIM_TEST: $TRIM_TEST"