Skip to content

Commit

Permalink
test commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Chethan-rao committed Nov 20, 2023
1 parent d3e3c1c commit 51a350e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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}")
fi
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV
echo "branch: $GITHUB_REF_NAME"
echo "docker_tag: ${{ env.DOCKER_TAG }}"

0 comments on commit 51a350e

Please sign in to comment.