-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a072f9
commit 409e30c
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Build and publish Docker image | ||
on: | ||
# Trigger the workflow on push or pull request, | ||
# for the develop branch and all new tags | ||
push: | ||
branches: | ||
- master | ||
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 ::set-env name=RELEASE_VERSION::$(git describe --tags --abbrev=0 ${GITHUB_SHA}) | ||
- name: Publish to Registry | ||
uses: elgohr/Publish-Docker-Github-Action@master | ||
env: | ||
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_BRANCH,GIT_REVISION | ||
tags: "${{ env.RELEASE_VERSION }}" |