fix syntax #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build gh release from tag | ||
on: | ||
push: | ||
tags: | ||
- "*/v*" | ||
env: | ||
REGISTRY: ghcr.io | ||
jobs: | ||
publish-ghcr-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: olegtarasov/[email protected] | ||
id: tagName | ||
with: | ||
tagRegex: (?<service>.*)\/v(?<version>.*) #example: backend/v1.2.3 | ||
tagRegexGroup: 0 | ||
- name: show-service | ||
env: | ||
ghRef: ${{ github.ref }} | ||
service: ${{ steps.tagName.outputs.service }} | ||
version: ${{ steps.tagName.outputs.version }} | ||
tagFromAction: ${{ steps.tagName.outputs.tag }} | ||
run: | | ||
echo "Ref: $ghRef" | ||
echo "Service: $service" | ||
echo "Version: $version" | ||
echo "tagFromAction: $tagFromAction" | ||
- name: Check out Git repository | ||
uses: actions/checkout@v4 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
env: | ||
service: ${{ steps.tagName.outputs.service }} | ||
with: | ||
cache: 'maven' | ||
cache-dependency-path: '${{ service }}/pom.xml' | ||
Check failure on line 42 in .github/workflows/create-ghcr-image-from-tag.yml GitHub Actions / build gh release from tagInvalid workflow file
|
||
java-version: '17' | ||
distribution: 'temurin' | ||
- name: build jar without tests | ||
run: mvn -B -ntp -DskipTests package | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
env: | ||
service: ${{ steps.tagName.outputs.service }} | ||
image: ${{ env.REGISTRY }}/${{ github.repository }}-${{ service }} | ||
tagDefinitionMajorOnly: "type=match,pattern=(${{ service }})/v(\\d).\\d.\\d,group=2" | ||
tagDefinitionMajorMinor: "type=match,pattern=(${{ service }})/v(\\d.\\d).\\d,group=2" | ||
tagDefinitionFullVersion: "type=match,pattern=(${{ service }})/v(.*),group=2" | ||
with: | ||
images: ${{ image }} | ||
tags: | | ||
${{ tagDefinitionMajorOnly }} | ||
${{ tagDefinitionMajorMinor }} | ||
${{ tagDefinitionFullVersion }} | ||
type=raw,value=latest | ||
- name: Build and push image | ||
uses: docker/build-push-action@v5 | ||
env: | ||
service: ${{ steps.tagName.outputs.service }} | ||
with: | ||
context: ./${{ service }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |