Skip to content

try getting git context from git and not from workflow #17

try getting git context from git and not from workflow

try getting git context from git and not from workflow #17

name: build ghcr image from tag
on:
push:
tags:
- "*/v*"
env:
REGISTRY: ghcr.io
jobs:
extract-service:
runs-on: ubuntu-latest
outputs:
service: ${{ steps.getTagNameParts.outputs.service }}
version: ${{ steps.getTagNameParts.outputs.version }}
tag: ${{ steps.getTagNameParts.outputs.tag }}
steps:
- uses: olegtarasov/[email protected]
id: getTagNameParts
with:
tagRegex: (?<service>.*)\/v(?<version>.*) #example: backend/v1.2.3
tagRegexGroup: 0
- name: show-service
env:
ghRef: ${{ github.ref }}
service: ${{ steps.getTagNameParts.outputs.service }}
version: ${{ steps.getTagNameParts.outputs.version }}
tagFromAction: ${{ steps.getTagNameParts.outputs.tag }}
run: |
echo "Ref: $ghRef"
echo "Service: $service"
echo "Version: $version"
echo "tagFromAction: $tagFromAction"
publish-ghcr-image:
permissions:
packages: write
needs:
- extract-service
uses: ./.github/workflows/callable-create-ghcr-image-from-tag.yml
with:
tag: ${{ needs.extract-service.outputs.service }}/v${{ needs.extract-service.outputs.version }}
service: ${{ needs.extract-service.outputs.service }}