-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (27 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
name: Docker Image CI
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: get the user or organization name
run: echo "USER_NAME=$(echo '${{ github.repository }}' | awk '{print tolower($0)}' | cut -d/ -f 1 | tr -d -)" >> $GITHUB_ENV
shell: bash
- name: get the repository name
run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk '{print tolower($0)}' | cut -d/ -f 2)" >> $GITHUB_ENV
shell: bash
- name: Get the version
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
- name: Build the tagged Docker image
run: docker build . --file Dockerfile --tag ${{ env.USER_NAME }}/${{ env.REPOSITORY_NAME }}:${{ steps.vars.outputs.tag }}
- name: Push the tagged Docker image
run: docker push ${{ env.USER_NAME }}/${{ env.REPOSITORY_NAME }}:${{ steps.vars.outputs.tag }}