Skip to content

GitHub Actions, publish to Docker Hub #2

GitHub Actions, publish to Docker Hub

GitHub Actions, publish to Docker Hub #2

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
name: Publish Docker Image
on:
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Set Version Number
run: echo "VERSION=$(cat ./VERSION)" >> $GITHUB_ENV
- name: Print Release Version
run: echo ${{ env.$VERSION }}

Check failure on line 26 in .github/workflows/publish.yml

View workflow run for this annotation

GitHub Actions / Publish Docker Image

Invalid workflow file

The workflow is not valid. .github/workflows/publish.yml (Line: 26, Col: 14): Unexpected symbol: '$VERSION'. Located at position 5 within expression: env.$VERSION .github/workflows/publish.yml (Line: 36, Col: 22): Unexpected symbol: '$VERSION'. Located at position 5 within expression: env.$VERSION
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: -P echo ${{ env.$VERSION }} build
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: garambo/retrosearch
- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}