Skip to content

Add permissions

Add permissions #88

Workflow file for this run

name: Build Docker Image
on:
push:
branches: [dev]
jobs:
build:

Check failure on line 8 in .github/workflows/gradle.yml

View workflow run for this annotation

GitHub Actions / Build Docker Image

Invalid workflow file

The workflow is not valid. .github/workflows/gradle.yml (Line: 8, Col: 3): The workflow must contain at least one job with no dependencies.
runs-on: ubuntu-latest
needs:
- build
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: "21"
distribution: "adopt"
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker Build-Tag-Push my-app
run: |
./gradlew bootImageBuild
docker tag my-app:1.0.0-SNAPSHOT ${{ secrets.DOCKERHUB_USERNAME }}/my-app:latest
docker push ${{ secrets.DOCKERHUB_USERNAME }}/my-app:latest
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties