-
Notifications
You must be signed in to change notification settings - Fork 17
58 lines (49 loc) · 1.94 KB
/
deploy-docker-image-release.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
name: Deploy - Docker Image Release
on:
push:
tags:
- 'v*'
jobs:
buildandpush:
runs-on: ubuntu-latest
# Docs: https://docs.github.com/en/actions/deployment/about-deployments/deploying-with-github-actions
environment: dockerhub
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Extract tag name
id: extract_tag
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
run: |
docker build . --file Dockerfile --tag "devops-toolkit-release:${{ env.TAG_NAME }}"
- name: Verify tool versions
run: |
cd scripts
chmod +x check_version_in_toolkit.sh
./check_version_in_toolkit.sh "devops-toolkit-release:${{ env.TAG_NAME }}" "../toolkit_info.json"
- name: Running Sample Tool Code
run: |
echo "Run sample tool code inside toolkit"
docker run --rm devops-toolkit-release:${{ env.TAG_NAME }} samples/run_sample.sh
- name: Push Docker Image
run: |
docker tag "devops-toolkit-release:${{ env.TAG_NAME }}" "tungbq/devops-toolkit:${{ env.TAG_NAME }}"
docker tag "devops-toolkit-release:${{ env.TAG_NAME }}" "tungbq/devops-toolkit:latest"
docker images
echo "Push image with TAG_NAME"
docker push "tungbq/devops-toolkit:${{ env.TAG_NAME }}"
echo "Push latest image"
docker push "tungbq/devops-toolkit:latest"
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: tungbq/devops-toolkit
enable-url-completion: true