-
Notifications
You must be signed in to change notification settings - Fork 2
163 lines (137 loc) · 6.09 KB
/
release.yaml
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
on:
push:
branches:
- refine_workflow
# pull_request:
# branches:
# - main
jobs:
build:
environment: preview
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: 18 # Use Node.js 18 here
- name: Install Dependencies
run: npm install
- name: Build App
env:
TYPESENSE_PROTOCOL: ${{ vars.TYPESENSE_PROTOCOL }}
TYPESENSE_HOST: ${{ vars.TYPESENSE_HOST }}
TYPESENSE_PORT: ${{ vars.TYPESENSE_PORT }}
TYPESENSE_API_KEY: ${{ secrets.TYPESENSE_SEARCH_KEY }}
run: npm run build
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Get Commit Hash
id: commit_hash
uses: prompt/actions-commit-hash@v3
- uses: docker/setup-buildx-action@v3
- name: Build and Push (Docker Image)
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.IMG_NAME }}:latest
${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.IMG_NAME }}:${{ vars.APP_VERSION }}.${{github.run_number}}-${{ steps.commit_hash.outputs.short }}
# - name: Image Digest
# run: echo ${{ steps.docker_build.outputs.digest }}
update-helm-charts:
needs: [build]
environment: preview
runs-on: ubuntu-latest
steps:
- name: Get Commit Hash
id: commit_hash
uses: prompt/actions-commit-hash@v3
- name: Show Commit Hash Digest
run: echo ${{ steps.commit_hash.outputs.short }}
- name: Configure Git User as GitHub Actions Bot
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Checkout
uses: actions/checkout@v4
with:
repository: "${{ vars.DOCS_NEXT_CHARTS_ORG }}/${{ vars.DOCS_NEXT_CHARTS_REPO }}"
token: ${{ secrets.DOCS_NEXT_CHARTS_TOKEN }}
- name: Show Contents
run: ls -latr
- uses: fjogeleit/yaml-update-action@main
with:
valueFile: './charts/docusaurus/Chart.yaml'
createPR: 'false'
commitChange: 'false'
changes: |
{
"version": "${{ vars.APP_VERSION }}.${{github.run_number}}",
"appVersion": "${{ vars.APP_VERSION }}.${{github.run_number}}-${{ steps.commit_hash.outputs.short }}"
}
- uses: fjogeleit/yaml-update-action@main
with:
valueFile: './charts/typesense/Chart.yaml'
createPR: 'false'
commitChange: 'false'
changes: |
{
"version": "${{ vars.APP_VERSION }}.${{github.run_number}}",
"appVersion": "${{ vars.APP_VERSION }}.${{github.run_number}}-${{ steps.commit_hash.outputs.short }}"
}
# - name: Update Docusaurus Chart.yaml
# uses: rmeneely/update-yaml@v1
# with:
# infile: './charts/docusaurus/Chart.yaml'
# varlist: version=${{ vars.APP_VERSION }}.${{github.run_number}},appVersion=${{ vars.APP_VERSION }}.${{github.run_number}}-${{ steps.commit_hash.outputs.short }}
# - name: Update Docusaurus values.yaml
# uses: rmeneely/update-yaml@v1
# with:
# infile: './charts/docusaurus/values.yaml'
# varlist: image.tag=${{ vars.APP_VERSION }}.${{github.run_number}}-${{ steps.commit_hash.outputs.short }},env.typesenseHost=${{ vars.TYPESENSE_HOST }},env.typesensePort=\"${{ vars.TYPESENSE_PORT }}\",env.typesenseProtocol=${{ vars.TYPESENSE_PROTOCOL }},env.typesenseSearchApiKey=${{ secrets.TYPESENSE_SEARCH_KEY }},ingress.elbId=${{ vars.DOCS_NEXT_ELB_ID }},ingress.host=${{ vars.DOCS_NEXT_HOST }},ingress.port=80
# - name: Update Typesense Chart.yaml
# uses: rmeneely/update-yaml@v1
# with:
# infile: './charts/typesense/Chart.yaml'
# varlist: version=${{ vars.APP_VERSION }}.${{github.run_number}},appVersion=${{ vars.APP_VERSION }}.${{github.run_number}}-${{ steps.commit_hash.outputs.short }}
# - name: Update Typesense values.yaml
# uses: rmeneely/update-yaml@v1
# with:
# infile: './charts/typesense/values.yaml'
# varlist: typesense.apiKey=${{ secrets.TYPESENSE_API_KEY }},docusaurus.externalUrl=${{ vars.DOCS_NEXT_HOST }},reverseProxy.ingress.elbId=${{ vars.TYPESENSE_ELB_ID }},reverseProxy.ingress.host=${{ vars.TYPESENSE_HOST }},reverseProxy.ingress.port=${{ vars.TYPESENSE_PORT }}
- name: Commit Changes
id: update_charts
run: |
# docusaurus
cat ./charts/docusaurus/Chart.yaml
echo ""
echo "---"
echo ""
cat ./charts/docusaurus/values.yaml
echo ""
echo "---"
echo ""
# typesense
cat ./charts/typesense/Chart.yaml
echo ""
echo "---"
echo ""
cat ./charts/typesense/values.yaml
echo ""
echo "---"
echo ""
# commit and push
git commit -am "Automatic commit from GitHub Actions triggered by action #${{github.run_number}}"
git remote set-url origin https://${{ secrets.DOCS_NEXT_CHARTS_TOKEN }}@github.com/${{ vars.DOCS_NEXT_CHARTS_ORG }}/${{ vars.DOCS_NEXT_CHARTS_REPO }}.git
# git push origin main