Skip to content

Commit

Permalink
try tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jordotech committed Jul 11, 2023
1 parent 1db2653 commit 6cc3a96
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/build_and_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name: Build and Push Docker Image
on:
push:
branches:
- '*'
- main
- build
tags:
- '*' # Push events to all tags

env:
DOCKERHUB_USERNAME: jordotech
Expand All @@ -21,9 +24,19 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Get branch name
id: branch_name
run: echo ::set-output name=branch::${GITHUB_REF#refs/heads/}
- name: Get branch or tag name
id: branch_or_tag_name
run: echo ::set-output name=name::${GITHUB_REF#refs/*/}

- name: Determine tag
id: image_tag
run: |
if [[ "${{ steps.branch_or_tag_name.outputs.name }}" == "tags"* ]]; then
echo "::set-output name=tag::${{ steps.branch_or_tag_name.outputs.name#tags/ }}"
else
echo "::set-output name=tag::${{ github.sha }}"
fi
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
Expand Down

0 comments on commit 6cc3a96

Please sign in to comment.