Skip to content

Commit

Permalink
build: enable workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
sarunint committed Dec 6, 2024
1 parent fd9f30f commit 5eeaa50
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: build
on:
push:
branches:
- main
tags:
- v*

jobs:
build:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Initialise JDK 21
uses: actions/setup-java@v3
with:
java-version: 21
distribution: 'microsoft'
- name: Replace version number in gradle.properties
if: ${{ github.event.created && startsWith(github.ref, 'refs/tags/') }}
run: |
sed -i -e "s|0.0.0-PLACEHOLDER|$(echo "${{ github.ref }}" | sed -e "s|refs/tags/v||g" -)|g" gradle.properties
cat gradle.properties
- name: Build
run: ./gradlew build
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/libs/
- name: Publish
uses: Kir-Antipov/[email protected]
if: ${{ github.event.created && startsWith(github.ref, 'refs/tags/') }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ version = project.mod_version
group = project.maven_group

base {
archivesName = project.archives_base_name
archivesName = project.archives_base_name + '-mc' + project.minecraft_version + '-' + project.loader
}

if (version == '0.0.0-PLACEHOLDER') {
version += "." + new Date().format('yyyyMMdd.HHmmss')
}

repositories {
Expand Down Expand Up @@ -69,7 +73,7 @@ java {

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
rename { "${it}_${project.base.archivesName.get()}"}
}
}

Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ org.gradle.parallel=true
loom_version=1.9-SNAPSHOT

# Mod Properties
mod_version=0.15.4b
mod_version=0.0.0-PLACEHOLDER
maven_group=eu.pabl
archives_base_name=twitchchat
loader=fabric

# Dependencies
fabric_version=0.111.0+1.21.4
Expand Down

0 comments on commit 5eeaa50

Please sign in to comment.