-
Notifications
You must be signed in to change notification settings - Fork 2
146 lines (137 loc) Β· 4.23 KB
/
Copy pathequinor-algolia-indexers.yaml
File metadata and controls
146 lines (137 loc) Β· 4.23 KB
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
name: Equinor Algolia indexers workflow
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment for algolia indexers'
required: true
type: choice
options:
- development
- production
default: development
#push:
# branches:
# - main
# - staging
# paths:
# - 'search/**'
# - '!./README.md'
# - '!./.env.template'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
BUILD_OUTPUT_PATH: ${{ github.workspace }}/search
BUILD_PACKAGE_NAME: indexers.zip
BUILD_ARTIFACT_PATH: ${{ github.workspace }}/build_artifacts
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
permissions:
contents: read
jobs:
check-code:
runs-on: ubuntu-latest
environment:
name: ${{ github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'production') || 'development'}}
env:
DOCKER_BUILDKIT: 1
steps:
- name: Checkout ποΈ
uses: actions/checkout@v6
- name: Install pnpm π¦
id: install-pnpm
uses: pnpm/action-setup@v4
- name: Cache pnpm modules πΎ
uses: actions/setup-node@v7
with:
node-version: 24
# cache: 'npm'
- name: Install dependencies π§
id: install-dependencies
run: |
pushd search
pnpm install
popd
- name: Run tests π
id: test
run: |
pnpm search-indexers test
- name: log-errors-to-slack π
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()
build-function-application:
needs: check-code
runs-on: ubuntu-latest
environment:
name: ${{ github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'production') || 'development'}}
steps:
- name: Checkout ποΈ
uses: actions/checkout@v6
- name: Install pnpm π¦
id: install-pnpm
uses: pnpm/action-setup@v4
- name: Cache pnpm modules πΎ
uses: actions/setup-node@v7
with:
node-version: 24
# cache: 'npm'
- name: Install dependencies π§
id: install-dependencies
run: |
pnpm search-indexers install --node-linker=hoisted
- name: Build β
id: build-functions
run: |
pnpm search-indexers build
mkdir ${{ env.BUILD_ARTIFACT_PATH }}
pushd ${{ env.BUILD_OUTPUT_PATH }}
zip -r ${{ env.BUILD_ARTIFACT_PATH }}/${{ env.BUILD_PACKAGE_NAME }} .
popd
- name: Package Azure Function release build
id: package-artifact
uses: actions/upload-artifact@v4
with:
name: ${{ vars.AZ_ALGOLIA_FUNC_APP_NAME }}
path: ${{ env.BUILD_ARTIFACT_PATH }}
- name: log-errors-to-slack π
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()
deploy-function-application:
environment:
name: ${{ github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'production') || 'development'}}
needs: [build-function-application]
runs-on: ubuntu-latest
steps:
- name: Login to Azure π₯οΈ
id: login-to-azure
uses: azure/login@v1
with:
creds: ${{ secrets.ENVIS_ACTIONS_SERVICE_PRINCIPAL }}
- name: 'Create output directory'
shell: bash
run: |
mkdir ${{ env.BUILD_ARTIFACT_PATH }}
# Fetch published code
- name: Download Azure function release build
id: download-artifacts
uses: actions/download-artifact@v4.1.7
with:
name: ${{ vars.AZ_ALGOLIA_FUNC_APP_NAME }}
path: ${{ env.BUILD_ARTIFACT_PATH }}
# Deploy Azure functions code
- name: Run Azure Functions Action
id: deploy
uses: azure/functions-action@v1
with:
app-name: ${{ vars.AZ_ALGOLIA_FUNC_APP_NAME }}
package: ${{ env.BUILD_ARTIFACT_PATH }}/${{ env.BUILD_PACKAGE_NAME }}
- name: log-errors-to-slack π
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()