-
Notifications
You must be signed in to change notification settings - Fork 2
39 lines (32 loc) · 1.17 KB
/
docker-image.yml
File metadata and controls
39 lines (32 loc) · 1.17 KB
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
name: Docker Image CI
on:
workflow_dispatch:
inputs:
tag:
description: 'Version tag to use (e.g. v1.2.3)'
required: true
default: ''
jobs:
build:
runs-on: windows-2022
steps:
- name: Check Out Repo
uses: actions/checkout@v2
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set output variables
id: vars
run: |
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
echo "DOCKER_TAG=$('${{ github.event.inputs.tag }}' -replace '^v', '' -replace '\.\w+$', '')" >> $env:GITHUB_OUTPUT
} else {
echo "DOCKER_TAG=$('${{ github.ref_name }}' -replace '^v', '' -replace '\.\w+$', '')" >> $env:GITHUB_OUTPUT
}
- name: Build Docker image
run: docker build . --file Dockerfile --tag ababak/cgcpp:${{ steps.vars.outputs.DOCKER_TAG }}
- name: Push
run: docker push ababak/cgcpp:${{ steps.vars.outputs.DOCKER_TAG }}