-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8de0312
commit 28aef22
Showing
1 changed file
with
51 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |