-
Notifications
You must be signed in to change notification settings - Fork 1
174 lines (172 loc) · 5.91 KB
/
publish.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# Build and push shared-workflows
on:
push:
branches:
- main
paths:
- CHANGELOG.md
workflow_dispatch:
jobs:
get_variables:
runs-on: ubuntu-latest
outputs:
app_name: ${{ steps.set_vars.outputs.app_name }}
repo_name: ${{ steps.set_vars.outputs.repo_name }}
version: ${{ steps.semver.outputs.current-version }}
steps:
- uses: actions/checkout@v3
- id: semver
uses: martinbeentjes/npm-get-version-action@main
- run: sudo apt-get install jq
- id: set_vars
run: |
APP_NAME=$(jq -r '.app_name' ./app.config.json)
echo "repo_name=$APP_NAME" >> $GITHUB_OUTPUT
REPO_NAME=$(jq -r '.repo_name' ./app.config.json)
echo "repo_name=$REPO_NAME" >> $GITHUB_OUTPUT
integrated_tests:
permissions:
id-token: write
contents: read
packages: write
needs: get_variables
env:
APP_NAME: ${{ needs.get_variables.outputs.app_name }}
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PAT }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: configure-node
uses: actions/setup-node@v3
with:
node-version: 20
- name: create .yarnrc file
run: |
npm config set "@telicent-io:registry" "https://npm.pkg.github.com/"
npm config set "//npm.pkg.github.com/:_authToken" ${{ secrets.PACKAGE_PAT }}
- name: Get node version
id: node
run: |
echo "version=$(node -v)" >> $GITHUB_OUTPUT
- name: Get node_modules cache
uses: actions/cache@v3.0.2
id: node_modules
with:
path: |
**/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}-${{ steps.node.outputs.version }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Install dependencies
run: yarn install --frozen-lockfile
- run: mkdir reports
- run: yarn test:ci
# # TODO renable #1
# # WHEN this goes public
# # HOW uncomment 👇, and delete the DRY RUN version below
# publish_build_image_to_registries:
# needs:
# - integrated_tests
# - get_variables
# uses: telicent-oss/shared-workflows/.github/workflows/docker-push-to-registries.yml@main
# with:
# APP_NAME: ${{ needs.get_variables.outputs.app_name }}
# DOCKERFILE: Dockerfile.build
# PATH: .
# VERSION: ${{ needs.get_variables.outputs.version }}
# VERSION_SUFFIX: -build
# ECR_SUFFIX: -build
# secrets: inherit
#
# 👇 (to delete)
publish_build_image_to_registries:
needs:
- integrated_tests
- get_variables
runs-on: ubuntu-latest
steps:
- name: Dry Run for Publishing Build Image
run: |
echo "DRY-RUN"
echo " uses: telicent-oss/shared-workflows/.github/workflows/docker-push-to-registries.yml@main"
echo " with:"
echo " APP_NAME=\${{ needs.get_variables.outputs.app_name }}"
echo " PATH=."
echo " DOCKER_FILE=Dockerfile"
echo " VERSION=\${{ needs.get_variables.outputs.version }}"
echo " VERSION_SUFFIX: -build
echo " ECR_SUFFIX: -build
# # TODO renable #2
# # WHEN this goes public
# # HOW uncomment 👇, and delete the DRY RUN version below
# publish_deployment_image_to_registries:
# needs:
# - integrated_tests
# - get_variables
# - publish_build_image_to_registries
# uses: telicent-oss/shared-workflows/.github/workflows/docker-push-to-registries.yml@main
# with:
# APP_NAME: ${{ needs.get_variables.outputs.app_name }}
# DOCKERFILE: Dockerfile
# PATH: .
# VERSION: ${{ needs.get_variables.outputs.version }}
# secrets: inherit
#
# (👇 to delete)
publish_deployment_image_to_registries:
needs:
- integrated_tests
- get_variables
- publish_build_image_to_registries
runs-on: ubuntu-latest
steps:
- name: Dry Run for Publishing Docker Image
run: |
echo "DRY-RUN"
echo " uses: telicent-oss/shared-workflows/.github/workflows/docker-push-to-registries.yml@main"
echo " with:"
echo " APP_NAME=\${{ needs.get_variables.outputs.app_name }}"
echo " PATH=."
echo " DOCKER_FILE=Dockerfile"
echo " VERSION=\${{ needs.get_variables.outputs.version }}"
# TODO reanable #3
# WHEN this goes public
# HOW 👇 Uncomment all of this:
# trigger_multi_app_build:
# runs-on: ubuntu-latest
# needs: publish_build_image_to_registries
# steps:
# - name: Trigger build of multi app docker image
# uses: actions/github-script@v6
# with:
# github-token: ${{ secrets.PACKAGE_PAT }}
# script: |
# await github.rest.actions.createWorkflowDispatch({
# owner: 'Telicent-oss',
# repo: 'telicent-deployments',
# workflow_id: 'app-build.yml',
# ref: 'main'
# })
# trigger_suite_versioning:
# runs-on: ubuntu-latest
# needs: publish_build_image_to_registries
# steps:
# - name: Trigger versioning for all images required in search suite
# uses: actions/github-script@v6
# with:
# github-token: ${{ secrets.PACKAGE_PAT }}
# script: |
# await github.rest.actions.createWorkflowDispatch({
# owner: 'Telicent-oss',
# repo: 'shared-workflows',
# workflow_id: '${{ needs.get_variables.outputs.app_name_snake_case }}_checks.yml',
# ref: 'main'
# })
# trigger_owasp_dependency_check:
# needs:
# - publish_build_image_to_registries
# uses: telicent-oss/shared-workflows/.github/workflows/dependency_tracking.yml@main
# with:
# APP_NAME: ${{ needs.get_variables.outputs.app_name }}
# secrets: inherit