Skip to content

Commit

Permalink
Modernize github action
Browse files Browse the repository at this point in the history
Should reduce failed builds due to maven timeouts
  • Loading branch information
klikli-dev committed Dec 22, 2020
1 parent 379a8ae commit 0f0424b
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions .github/workflows/build_and_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,32 @@ name: Build and Publish

on:
push:
tags:
- 'alpha/v**'
- 'beta/v**'
- 'release/v**'
- 'test/v**'
tags:
- 'alpha/v**'
- 'beta/v**'
- 'release/v**'
- 'test/v**'

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v2
- name: Set up JDK 1.8
id: set_up_jdk
uses: actions/setup-java@v1
with:
java-version: 1.8
java-package: jdk
architecture: x64
- name: Get release type from github tag
id: get_release_type
uses: actions/github-script@0.4.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
return '${{ github.ref }}'.match(/refs\/tags\/(.*)\/v((.*)-(.*))/)[1];
return '${{ github.ref }}'.match(/refs\/tags\/(.*)\/v((.*)-(.*))/)[1];
- name: Get file version from tag
id: get_version
uses: actions/github-script@0.4.0
Expand All @@ -46,18 +44,16 @@ jobs:
result-encoding: string
script: |
return '${{ github.ref }}'.match(/refs\/tags\/(.*)\/v((.*)-(.*))/)[3];
# - name: Restore cache
# uses: actions/cache@v1
# with:
# path: ~/.gradle/caches
# key: ${{ runner.os }}-gradle-${{ hashFiles('build.gradle') }}
- name: Setup Gradle
run: chmod +x gradlew
- name: Build
run: ./gradlew build --no-daemon --refresh-dependencies
- name: "Build"
uses: eskatos/gradle-command-action@v1
env:
VERSION: ${{ steps.get_mc_version.outputs.result }}-${{ steps.get_version.outputs.result }}
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
with:
arguments: build --max-workers 1
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -78,7 +74,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/libs/occultism-${{ steps.get_mc_version.outputs.result }}-${{ steps.get_version.outputs.result }}.jar
asset_name: occultism-${{ steps.get_mc_version.outputs.result }}-${{ steps.get_version.outputs.result }}.jar
asset_content_type: application/java-archive
Expand Down

0 comments on commit 0f0424b

Please sign in to comment.