Skip to content

Build image

Build image #7

Workflow file for this run

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
- 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 "DOCKER_TAG=$GITHUB_REF_NAME" >> $GITHUB_ENV
else
git fetch origin $GITHUB_REF_NAME
echo "DOCKER_TAG=$(git rev-parse "$GITHUB_REF_NAME^{commit}")" >> $GITHUB_ENV
fi
echo "branch: $GITHUB_REF_NAME"
echo "docker_tag: ${{ env.DOCKER_TAG }}"