-
Notifications
You must be signed in to change notification settings - Fork 4
38 lines (38 loc) · 1.32 KB
/
docker-build-publish-release.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
name: Build and publish Docker image for Release
on:
# Trigger the workflow on push or pull request,
# for the develop branch and all new tags
push:
tags:
- v*
- preview-*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Fetch Prune Unshallow Tags
run: git fetch --prune --unshallow --tags
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Extract commit hash
shell: bash
run: echo "##[set-output name=hash;]$(git rev-parse --short ${GITHUB_SHA})"
id: extract_hash
- name: Extract latest tag
shell: bash
run: echo "RELEASE_VERSION="$(git describe --tags --abbrev=0 ${GITHUB_SHA}) >> $GITHUB_ENV
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v4
env:
GIT_TAG: ${{ env.RELEASE_VERSION }}
GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }}
GIT_REVISION: ${{ steps.extract_hash.outputs.hash }}
with:
name: c2dhunilu/journal-of-digital-history
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
buildargs: GIT_TAG,GIT_BRANCH,GIT_REVISION
tags: "${{ env.RELEASE_VERSION }}"