Skip to content

Commit

Permalink
Fix github action
Browse files Browse the repository at this point in the history
  • Loading branch information
orblazer committed Jul 20, 2020
1 parent e90b563 commit 45adb8f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 31 deletions.
52 changes: 22 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,42 @@
on:
push:
branch:
- master
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release

jobs:
compile:
runs-on: ubuntu-latest
name: Java 8 compile
steps:
- uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 1.8
- run: mvn clean package
build:
runs-on: ubuntu-latest
needs: compile
name: Build maven project
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Get the version
id: version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Build and test project
run: mvn clean verify
- name: Build project
run: mvn clean package -Dversion=${{ steps.version.outputs.VERSION }}
- name: Upload Maven build artifact
uses: actions/upload-artifact@v1
with:
name: artifact
path: target/bungee-rcon-${{ github.ref }}.jar
path: target/bungee-rcon-${{ steps.version.outputs.VERSION }}.jar
release:
name: Create Release
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v1
- name: Get the version
id: version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- name: Download Maven build artifact
uses: actions/download-artifact@v1
with:
Expand All @@ -56,16 +48,16 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
release_name: Release v${{ steps.version.outputs.VERSION }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: target/bungee-rcon-${{ github.ref }}.jar
asset_name: bungee-rcon-${{ github.ref }}.jar
asset_content_type: application/java-archive
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: artifact/bungee-rcon-${{ steps.version.outputs.VERSION }}.jar
asset_name: bungee-rcon-${{ steps.version.outputs.VERSION }}.jar
asset_content_type: application/java-archive
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
<description>Allow use rcon on bungeecord</description>
<groupId>fr.orblazer</groupId>
<artifactId>bungee-rcon</artifactId>
<version>1.0.0</version>
<version>${version}</version>
<packaging>jar</packaging>

<properties>
<version>SNAPSHOT</version>
</properties>

<repositories>
<repository>
<id>bungeecord-repo</id>
Expand Down

0 comments on commit 45adb8f

Please sign in to comment.