-
Notifications
You must be signed in to change notification settings - Fork 1
executable file
·38 lines (31 loc) · 996 Bytes
/
cd.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
name: cd
on:
push:
branches:
- 'develop'
tags:
- '*.*.*'
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Set up Docker
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Step 3: Log in to DockerHub
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Step 4: Build the Docker image targeting production
- name: Build and tag Docker image
run: |
docker build --target production -t ${{ secrets.DOCKERHUB_USERNAME }}/crystal:${{ github.ref_name }} .
# Step 5: Push the Docker image to DockerHub
- name: Push Docker image
run: |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/crystal:${{ github.ref_name }}