Skip to content

Commit

Permalink
update github action
Browse files Browse the repository at this point in the history
  • Loading branch information
plusls committed Sep 8, 2021
1 parent b84974f commit 3bb436f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 31 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ jobs:
id: getid
run: |
echo "::set-output name=commitID::${GITHUB_SHA::7}"
- name: Display commit id
run: |
echo MasaGadget commit-${{ steps.getid.outputs.commitID }} \(Public Beta\)
- name: Set commit id in codes
run: |
sed -i "s/alpha/beta.${{ steps.getid.outputs.commitID }}/g" gradle.properties
sed -i "s/alpha.114514/beta.${{ steps.getid.outputs.commitID }}/g" gradle.properties
- name: Read relevant fields from gradle.properties
id: properties
run: |
Expand All @@ -47,12 +44,6 @@ jobs:
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: copy linux deps
if: ${{ runner.os != 'Windows' }}
run: mkdir -p build/loom-cache && cp ./deps/* ./build/loom-cache/.
- name: copy windows deps
if: ${{ runner.os == 'Windows' }}
run: mkdir build\\loom-cache && copy .\deps\* .\\build\\loom-cache
- name: build
run: ./gradlew build
- name: capture build artifacts
Expand Down
36 changes: 16 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
matrix:
java: [ 16 ]
os: [ ubuntu-20.04 ]
branch: [ 1.16, 1.17 ]
branch: [ 1.16, 1.17, 1.18 ]
runs-on: ${{ matrix.os }}
steps:
- name: checkout repository
Expand All @@ -22,35 +22,25 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Display build number
run: echo MasaGadget build\#$GITHUB_RUN_NUMBER \(Public Release\)
- name: Set build number in codes
run: |
sed -i "s/build.undefined/build.$GITHUB_RUN_NUMBER/g" gradle.properties
sed -i "s/build.undefined/build.$GITHUB_RUN_NUMBER/g" src/main/java/com/plusls/MasaGadget/ModInfo.java
sed -i "s/Version Exception/Public Release/g" src/main/java/com/plusls/MasaGadget/ModInfo.java
sed -i "s/-alpha.114514//g" gradle.properties
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: copy linux deps
if: ${{ runner.os != 'Windows' }}
run: mkdir -p build/loom-cache && cp ./deps/* ./build/loom-cache/.
- name: copy windows deps
if: ${{ runner.os == 'Windows' }}
run: mkdir build\\loom-cache && copy .\deps\* .\\build\\loom-cache
- name: build
run: ./gradlew build
- name: Upload assets to GitHub
uses: AButler/[email protected]
if: ${{ runner.os == 'Linux' && matrix.java == '16' }}
with:
files: 'build/libs/*;LICENSE'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Find correct JAR
id: findjar
run: |
output="$(find build/libs/ ! -name "*-dev.jar" ! -name "*-sources.jar" -type f -printf "%f\n")"
echo "::set-output name=jarname::$output"
- name: Upload assets to GitHub
uses: AButler/[email protected]
if: ${{ runner.os == 'Linux' && matrix.java == '16' }}
with:
files: build/libs/${{ steps.findjar.outputs.jarname }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to Curseforge
uses: itsmeow/curseforge-upload@v3
with:
Expand All @@ -61,5 +51,11 @@ jobs:
changelog_type: markdown
changelog: ${{ github.event.release.body }}
# 1.16.5:8203, 1.17:8516, fabric:7499
game_versions: ${{ fromJson('{"1.16":"8203","1.17":"8516"}')[matrix.branch] }}, 7499
release_type: release
game_versions: ${{ fromJson('{"1.16":"8203","1.17":"8516","1.18":"8633"}')[matrix.branch] }}, 7499
release_type: release
- name: Upload to Modrinth
if: ${{ runner.os == 'Linux' && matrix.java == '16' }}
run: |
./gradlew publishModrinth
env:
MODRINTH: ${{ secrets.MODRINTH }}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minecraft_version=1.17.1
yarn_mappings=1.17.1+build.10
loader_version=0.11.6
# Mod Properties
mod_version=0.3.6-alpha
mod_version=0.3.7-alpha.114514
maven_group=com.plusls
archives_base_name=oh-my-minecraft-client
# Dependencies
Expand Down

0 comments on commit 3bb436f

Please sign in to comment.