Skip to content

Commit

Permalink
Testing GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaelmare committed Sep 24, 2023
1 parent 6db14b8 commit 2f62b43
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 1 deletion.
84 changes: 84 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Build

on:
push:
tags:
- 'v*'

env:

PROJECT_ID: "362368"

permissions:
contents: write

jobs:
main:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Get Version
id: version
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
let ref = '${{ github.ref }}';
return ref.startsWith('refs/tags/v') ? ref.replace('refs/tags/v', '') : 'indev';
- name: Get Version Type
id: version_type
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
let version = '${{ steps.version.outputs.result }}';
return version.includes('alpha') ? 'alpha' : (version.includes('beta') ? 'beta' : (version == 'indev' ? 'indev' : 'release'));
- name: Log Version Info
env:
VERSION: ${{ steps.version.outputs.result }}
VERSION_TYPE: ${{ steps.version_type.outputs.result }}
run: echo "version = $VERSION, type = $VERSION_TYPE"
- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: build
env:
VERSION: ${{ steps.version.outputs.result }}
- name: Create Release
id: create_release
if: ${{ steps.version.outputs.result != 'indev' && success() }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.result }}
release_name: DynamicTrees TFC v${{ steps.version.outputs.result }}
body: |
Version ${{ steps.version.outputs.result }}
### Changes
- todo: document changes
draft: true
prerelease: ${{ steps.version_type.outputs.result != 'release' }}
- name: Upload Main Jar
id: upload_main_jar
if: ${{ steps.version.outputs.result != 'indev' && success() }}
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/libs/dttfc-${{ steps.version.outputs.result }}.jar
asset_name: dttfc-${{ steps.version.outputs.result }}.jar
asset_content_type: application/java-archive
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'org.spongepowered.mixin'


version = '1.18.2-1.0.0-rc3'
version = '1.18.2-1.0.0-alpha3'
group = 'org.labellum.mc' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'dttfc'

Expand Down

0 comments on commit 2f62b43

Please sign in to comment.