Build image #7
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 | |
- 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 }}" |