-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (69 loc) · 2.44 KB
/
build.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
on:
push:
branches:
- create-build-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_API_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 }}:${{ steps.commit_hash.outputs.short }}
# - name: Image Digest
# run: echo ${{ steps.docker_build.outputs.digest }}
update-tag:
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: Update Image Tag
uses: cheelim1/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
REPO_NAME: 'docs-next-charts'
REPO_OWNER: 'akyriako'
FILE_PATH: 'docusaurus/deployment-docusaurus.yaml'
IMAGE_TAG: ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.IMG_NAME }}:${{ steps.commit_hash.outputs.short }}