forked from ido-namely/docker-protoc
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) · 1.43 KB
/
Copy pathdocker_release.yml
File metadata and controls
54 lines (46 loc) · 1.43 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Build, Tag & Push a new release to dockerhub off of a new pushed tag or gh_grpc_release.yml workflow
name: Docker Release
on:
workflow_call:
inputs:
release_version:
required: true
type: string
push:
tags:
- 'v[0-9]+.[0-9]+_[0-9]+'
jobs:
docker_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: nelonoel/branch-name@v1.0.1
- name: Docker Login
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: docker login --username "$DOCKERHUB_USERNAME" --password "$DOCKERHUB_TOKEN"
- name: Get Version
id: get_version
run: |
version=""
if [[ ${{ github.event_name }} == "pull_request" ]]; then
version=${{ inputs.release_version }}
fi
if [[ ${{ github.event_name }} == "push" ]]; then
version=${GITHUB_REF#refs/*/}
fi
# Strip "v" prefix from tag name and set to output var
echo ::set-output name=version::${version#v}
- name: Build and Tag
if: success()
env:
VERSION: ${{ steps.get_version.outputs.version }}
run: make tag-latest
- name: Push
if: success()
env:
VERSION: ${{ steps.get_version.outputs.version }}
run: make push-latest