Publish Docker image on Release #14
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
name: Publish Docker image on Release | |
on: | |
workflow_dispatch: | |
branches: [ master ] | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Get the tag version for building image | |
id: get_version | |
#run: echo ::set-env name=VERSION::$(git tag --sort=taggerdate -l [0-9]* | tail -n1) | |
run: echo ::set-env name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' | |
- name: Get current date for building image | |
id: get_date | |
run: echo "::set-output name=BUILD_TIME::$(date -u '+%Y-%m-%d_%H:%M:%S')" | |
- name: Get commit hash for building image | |
id: get_commit | |
run: echo "::set-output name=COMMIT::$(git rev-parse --short HEAD)" | |
- name: Publish to Registry | |
uses: elgohr/Publish-Docker-Github-Action@master | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' | |
PROJECT: github.com/nokia/adcs-issuer | |
with: | |
name: djkormo/adcs-issuer | |
buildargs: PROJECT,COMMIT,BUILD_TIME,VERSION | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
tags: "latest,${{ env.VERSION }}" |