-
Notifications
You must be signed in to change notification settings - Fork 3
33 lines (25 loc) · 1.11 KB
/
docker-image.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
name: Docker Image CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Extract version from project.toml
- name: Extract version from project.toml
id: project_version
run: echo "::set-output name=VERSION::$(sed -n 's/^version = \"\([^\"]*\)\"/\1/p' Project.toml)"
# Extract app name from project.toml
- name: Extract app name from project.toml
id: project_name
run: echo "::set-output name=APP_NAME::$(sed -n 's/^imgname = \"\([^\"]*\)\"/\1/p' Project.toml)"
- name: Build the Docker image
run: docker build . --file Dockerfile --tag pjgim/${{ steps.project_name.outputs.APP_NAME }}:${{ steps.project_version.outputs.VERSION }}
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin
- name: Push Docker image
run: docker push pjgim/${{ steps.project_name.outputs.APP_NAME }}:${{ steps.project_version.outputs.VERSION }}