Skip to content

Build image

Build image #12

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