Build image #15
Workflow file for this run
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: Build image | |
on: | |
push: | |
tags: | |
- "*" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Create docker tag if trigger event is 'push' | |
if: ${{ github.event_name == 'push' }} | |
shell: bash | |
run: | | |
echo "DOCKER_TAG=$GITHUB_REF_NAME" >> $GITHUB_ENV | |
echo "Inside push trigger: $GITHUB_REF_NAME" | |
- name: Create docker tag if trigger event is 'workflow_dispatch' | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
shell: bash | |
run: | | |
if [[ ${{ github.ref_type }} == 'tag' ]]; then | |
echo "inside worlflow - tag" | |
DOCKER_TAG=$GITHUB_REF_NAME | |
else | |
echo "inside worlflow - branch" | |
git fetch origin $GITHUB_REF_NAME | |
DOCKER_TAG=$(git rev-parse "$GITHUB_REF_NAME^{commit}") | |
fi | |
echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV | |
echo "ref_type: ${{ github.ref_type }}" | |
echo "branch: $GITHUB_REF_NAME" | |
echo "docker_tag: $DOCKER_TAG" |