Skip to content

Update deploy.yml

Update deploy.yml #14

Workflow file for this run

name: Java CI with Maven
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn clean package pom.xml
- name: List files in target directory
run: ls -l target
- name: Extract JAR version
id: extract_version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release v${{ github.run_number }}
body: Automatically created release
- name: Upload JAR to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/TaskApp-${{ env.VERSION }}.jar
asset_name: TaskApp-${{ github.run_number }}.jar
asset_content_type: application/java-archive
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}