Skip to content

Merge pull request #12 from ks6088ts/feature/issue-10_support-multi-s… #2

Merge pull request #12 from ks6088ts/feature/issue-10_support-multi-s…

Merge pull request #12 from ks6088ts/feature/issue-10_support-multi-s… #2

Workflow file for this run

name: docker-release
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: "ubuntu-latest"
timeout-minutes: 5
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# https://github.com/docker/build-push-action/issues/42#issuecomment-915323168
- name: Set Versions
uses: actions/github-script@v7
id: set_version
with:
script: |
const tag = context.ref.substring(10)
const no_v = tag.replace('v', '')
const dash_index = no_v.lastIndexOf('-')
const no_dash = (dash_index > -1) ? no_v.substring(0, dash_index) : no_v
core.setOutput('tag', tag)
core.setOutput('no-v', no_v)
core.setOutput('no-dash', no_dash)
- name: Build and push tag ${{steps.set_version.outputs.no-dash}}
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: |
GIT_REVISION=${{ github.sha }}
GIT_TAG=${{steps.set_version.outputs.no-dash}}
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/template-python:${{steps.set_version.outputs.no-dash}}
${{ secrets.DOCKERHUB_USERNAME }}/template-python:latest