-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (39 loc) · 1.33 KB
/
docker-hub.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
name: DockerHub
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
tags:
- 'v*.*.*'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
IMAGE_NAME: index.docker.io/metacall/cli
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build Docker Image
run: docker build --build-arg DISABLE_CACHE=`date +%s` -t metacall/cli -f Dockerfile .
- name: Login to DockerHub
if: github.event_name != 'pull_request'
run: docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" -p "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}"
- name: Push MetaCall CLI Docker Image to DockerHub
if: github.event_name != 'pull_request'
run: |
docker tag metacall/cli ${{ env.IMAGE_NAME }}:latest
docker push ${{ env.IMAGE_NAME }}:latest
if [[ "${{ contains(github.ref, 'refs/tags/') }}" = true ]]; then
TAG=${GITHUB_REF#refs/*/}
VERSION=${TAG#v}
docker tag metacall/cli ${{ env.IMAGE_NAME }}:${VERSION}
docker push ${{ env.IMAGE_NAME }}:${VERSION}
fi
- name: Logout from DockerHub
if: github.event_name != 'pull_request'
run: docker logout