Skip to content

Commit

Permalink
Github actions update
Browse files Browse the repository at this point in the history
  • Loading branch information
Spliterash committed Jun 11, 2024
1 parent 8de0312 commit 28aef22
Showing 1 changed file with 51 additions and 28 deletions.
79 changes: 51 additions & 28 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,59 @@
# 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 Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Build
name: Build and Release
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
tags: [ '*' ] # Запуск при создании тега

jobs:
build:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: build
- name: Upload Build Artifact
uses: actions/upload-artifact@v2
with:
name: musicbox
path: |
build/libs/MusicBox*-all.jar
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@937999e9cc2425eddc7fd62d1053baf041147db7
with:
arguments: build
- name: Upload Build Artifact
uses: actions/upload-artifact@v2
with:
name: musicbox
path: |
build/libs/MusicBox*-all.jar
- name: Checkout code
uses: actions/checkout@v2
- name: Download Build Artifact
uses: actions/download-artifact@v2
with:
name: musicbox
path: build/libs/
- name: Get Artifact Filename
id: get_filename
run: echo "FILENAME=$(basename build/libs/MusicBox*-all.jar)" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/libs/${{ env.FILENAME }}
asset_name: ${{ env.FILENAME }}
asset_content_type: application/java-archive

0 comments on commit 28aef22

Please sign in to comment.