-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (28 loc) · 877 Bytes
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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