GitHub Action implementation for determining the docker image tag from github repo properties.
- This will get the tag name "latest" for devel, main or master branches.
- It will otherwise use the basename - which should be either a tag name or branch name.
The output of this will be "latest" for a main branch - master, main and devel, or git tag name/git branch name in other cases.
Use with GitHub Actions
Example: .github/workflows/CI.yml
name: "CI"
on:
push:
branches:
- devel
pull_request:
jobs:
build_images:
name: "Build Images"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Determine tag
id: get_tag
uses: MasterOfMalt/Atom.DevOps.GitHubActions/Docker_Image_GetTag@v1
- name: echo tag_name
run: echo "tag=${{ steps.get_tag.outputs.tag_name }}"Outputs:
tag_name: "tag to use for the docker image"You can find a working and not working PR here