-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (60 loc) · 2.92 KB
/
test-replace-tokens-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
name: Test Action (Replace Tokens)
on:
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
node-version: [ 20.x ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set Up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Replace Tokens
uses: abhinavminhas/replace-tokens@main
with:
files: package.json
replacements: true=false
- name: Install (Clean), Build & Test
run: |
npm ci
npm run build --if-present
npm test
# Readme Examples
- name: Replace Tokens ( <<<< Example 1 - Replace a token in a file. >>>> )
uses: abhinavminhas/replace-tokens@main
with:
files: ./test/test-files/single_file_replace_single_token.txt
replacements: .=?
- name: Replace Tokens ( <<<< Example 2 - Replace multiple tokens in a file. >>>> )
uses: abhinavminhas/replace-tokens@main
with:
files: ./test/test-files/single_file_replace_multiple_different_tokens.txt
replacements: Hello=Hi, ....=?
- name: Replace Tokens ( <<<< Example 3 - Replace a token in multiple files. >>>> )
uses: abhinavminhas/replace-tokens@main
with:
files: |
./test/test-files/multiple_files_single_token/file1.json, ./test/test-files/multiple_files_single_token/file2.csv,
./test/test-files/multiple_files_single_token/file3.yml, ./test/test-files/multiple_files_single_token/file4.txt
replacements: 54c213d6-ac7f-44cb-8ac2-91e6a175af3d=18c11372-3b9a-49e1-98d1-6afafc247758
- name: Replace Tokens ( <<<< Example 4 - Replace multiple tokens in multiple files. >>>> )
uses: abhinavminhas/replace-tokens@main
with:
files: |
./test/test-files/multiple_files_mutiple_tokens/file1.json, ./test/test-files/multiple_files_mutiple_tokens/file2.csv,
./test/test-files/multiple_files_mutiple_tokens/file3.yml, ./test/test-files/multiple_files_mutiple_tokens/file4.txt
replacements: 54c213d6-ac7f-44cb-8ac2-91e6a175af3d=f859e2ad-2c56-40e5-9ead-539095ba6acd, 323acd81-6a1f-4eb8-bc6c-22a7711ab8ba=e10b5211-5fdb-4224-bb81-714bd3759c71
- name: Replace Tokens ( <<<< Example 5 - Use a different separator than comma. >>>> )
uses: abhinavminhas/replace-tokens@main
with:
files: |
./test/test-files/multiple_files_mutiple_tokens/file1.json | ./test/test-files/multiple_files_mutiple_tokens/file2.csv |
./test/test-files/multiple_files_mutiple_tokens/file3.yml | ./test/test-files/multiple_files_mutiple_tokens/file4.txt
replacements: f859e2ad-2c56-40e5-9ead-539095ba6acd=54c213d6-ac7f-44cb-8ac2-91e6a175af3d | e10b5211-5fdb-4224-bb81-714bd3759c71=323acd81-6a1f-4eb8-bc6c-22a7711ab8ba
delimiter: '|'