-
Notifications
You must be signed in to change notification settings - Fork 3
44 lines (34 loc) · 1.14 KB
/
docker.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
name: Docker Build and Push
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install Dependencies
run: npm ci
- name: Build CLI
run: npm run build
- name: Log in to Docker Hub
run: docker login -u ${{ secrets.MONOKLE_CLI_DOCKERHUB_USERNAME }} -p ${{ secrets.MONOKLE_CLI_DOCKERHUB_TOKEN }}
- name: Extract version from tag
id: extract_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Debug version
run: echo ${{ env.VERSION }}
- name: Build and deploy Docker image
env:
VERSION: ${{ env.VERSION }}
run: |
echo "Building Docker image with version: ${VERSION}"
docker build -t kubeshop/monokle-cli:latest -t kubeshop/monokle-cli:${VERSION} .
docker push kubeshop/monokle-cli:${VERSION}
docker push kubeshop/monokle-cli:latest