Skip to content

Commit

Permalink
ci: Create release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
itsamirhn committed Jun 5, 2024
1 parent 0c150ca commit c90c433
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release JAR

on:
push:
tags:
- "v*"

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- 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 -B package --file pom.xml

- name: Create Release
id: create_release
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Artifact
id: upload_artifact
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/Chess-1.0-SNAPSHOT.jar
asset_name: Chess.jar
asset_content_type: application/java-archive

0 comments on commit c90c433

Please sign in to comment.