-
Notifications
You must be signed in to change notification settings - Fork 87
83 lines (75 loc) · 2.68 KB
/
auto-build-publish-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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Auto Build Publish Test
on:
push:
branches:
- master
# Triggers the workflow on labeled PRs only.
pull_request_target:
types: [ labeled ]
# Ensures that only the latest commit is running for each PR at a time.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Auto-Build-Publish-Test:
name: Auto-Build-Publish-Test (${{ matrix.os }}) - (CLI ${{ matrix.cli-version }})
if: contains(github.event.pull_request.labels.*.name, 'safe to test') || github.event_name == 'push'
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
cli-version: [ "latest", "2.66.0" ]
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Go with cache
uses: jfrog/.github/actions/install-go-with-cache@main
- name: Install local Artifactory
uses: jfrog/.github/actions/install-local-artifactory@main
with:
RTLIC: ${{ secrets.RTLIC }}
- name: Post Step to Test the Auto Build-Publish post step
uses: gacts/run-and-post-run@v1
with:
post: |
jf c add --artifactory-url http://localhost:8081/artifactory --user admin --password password; \
count=$(jf rt search "artifactory-build-info/${GITHUB_WORKFLOW}/${GITHUB_RUN_NUMBER}-*" --count 2>stderr.log); \
exit_code=$?; \
cat stderr.log; \
if [ $exit_code -ne 0 ]; then \
echo "Command failed with exit code $exit_code."; \
exit 1; \
fi; \
if [ "$count" -eq 0 ]; then \
echo "No build info found."; \
exit 1; \
fi
- name: Setup JFrog CLI
id: setup-jfrog-cli
uses: ./
with:
version: ${{ matrix.cli-version }}
env:
JF_URL: http://localhost:8081/
JF_USER: admin
JF_PASSWORD: password
- name: Create NPM Remote Repository JSON
uses: jsdaniell/[email protected]
with:
name: "npm-remote-template.json"
json: '{
"key": "npm-remote",
"rclass": "remote",
"packageType": "npm",
"url": "https://registry.npmjs.org"
}'
- name: Configure Artifactory NPM Remote Repository
run: jf rt repo-create npm-remote-template.json
shell: bash
- name: Add npm modules to local build-info
run: |
jf npm-config --repo-resolve npm-remote
jf npm install