Skip to content

Homework1 maven-publish.yml fix 11 #12

Homework1 maven-publish.yml fix 11

Homework1 maven-publish.yml fix 11 #12

Workflow file for this run

# This workflow will build a package using Maven 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#apache-maven-with-a-settings-path
name: Homework1 Maven Package
on:
push:
branches:
- main
jobs:
maven:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
cache: 'maven'
- name: Check Java version
run: java -version
- name: Build with Maven
run: ./mvnw package
- name: Upload artifact for Docker job
uses: actions/upload-artifact@v3
with:
name: java-app
path: '${{ github.workspace }}/target/*.jar'
docker:
runs-on: ubuntu-latest
needs: maven
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Download artifact from Maven job
uses: actions/download-artifact@v3
with:
name: java-app
- name: Logging in to Docker
run: docker login ghcr.io -u shatvani -p ${{ github.token }}
- name: Build the Docker image
run: docker build . -t ghcr.io/shatvani/cubix/1/homework/app:springboot
- name: Publishing the Docker image
run: docker push ghcr.io/shatvani/cubix/1/homework/app:springboot
verification:
runs-on: ubuntu-latest
needs: docker
steps:
- uses: actions/checkout@v2
- name: Run verify-image.sh
run: ./verify-image.sh
shell: bash