forked from Anuken/Mindustry
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
82 changed files
with
1,264 additions
and
2,703 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as core from "@actions/core" | ||
import {context, getOctokit} from "@actions/github" | ||
|
||
const octokit = getOctokit(import.meta.env.GITHUB_TOKEN) as import("@octokit/plugin-rest-endpoint-methods/dist-types/types").Api | ||
const selfBuild = import.meta.env.RELEASE_VERSION | ||
|
||
async function clearOldAssets(tag: string, keep: number = 9) { | ||
const release = await octokit.rest.repos.getReleaseByTag({ | ||
...context.repo, tag | ||
}) | ||
const assets = release.data.assets.sort((a, b) => a.name < b.name ? 1 : -1) | ||
if (assets.length <= keep) return | ||
const toRemove = assets.slice(keep) | ||
toRemove.push(...assets.filter(it => it.name.includes("server") && !it.name.includes(selfBuild))) | ||
console.log("ToRemove", toRemove.map(it => it.name)) | ||
await Promise.all(toRemove.map(it => | ||
octokit.rest.repos.deleteReleaseAsset({ | ||
...context.repo, asset_id: it.id | ||
}) | ||
)) | ||
} | ||
|
||
await clearOldAssets(core.getInput("release") || import.meta.env.TAG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Build Artifacts | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 17 | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
with: | ||
gradle-version: 8.6 | ||
cache-read-only: false | ||
build-scan-publish: true | ||
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use" | ||
build-scan-terms-of-use-agree: "yes" | ||
- name: Set env | ||
run: | | ||
echo "RELEASE_TAG=${GITHUB_REF_NAME}-build" >> $GITHUB_ENV | ||
echo "RELEASE_TAG=${GITHUB_REF_NAME}-build" | ||
echo "RELEASE_VERSION=$(date +'%Y.%m.%d').X${GITHUB_RUN_NUMBER}-${GITHUB_REF_NAME}" >> $GITHUB_ENV | ||
echo "${{ secrets.KEYSTORE_BASE64 }}" | openssl enc -d -base64 -in - -out ../bekeystore.jks | ||
- name: Build | ||
run: | | ||
cd work | ||
../scripts/applyPatches | ||
gradle desktop:dist server:dist -Pbuildversion=${RELEASE_VERSION} | ||
cd .. | ||
mkdir artifacts | ||
mv work/desktop/build/libs/Mindustry.jar artifacts/MindustryX-${{env.RELEASE_VERSION}}-Desktop.jar | ||
mv work/server/build/libs/server-release.jar artifacts/server-${{env.RELEASE_VERSION}}.jar | ||
- name: Build Android | ||
env: | ||
keystore_password: ${{ secrets.KEYSTORE_PASSWORD_SECRET }} | ||
keystore_alias_password: ${{ secrets.KEYSTORE_PASSWORD_SECRET }} | ||
keystore_alias: MindustryX | ||
run: | | ||
cd work | ||
sed -i 's/tinylake.mindustryX/tinylake.mindustryX.be/g' android/build.gradle | ||
sed -i 's/MindustryX/MindustryX BE/g' android/res/values/strings.xml | ||
gradle android:assembleRelease -Pbuildversion=${RELEASE_VERSION} | ||
cd .. | ||
mv work/android/build/outputs/apk/release/android-release.apk artifacts/MindustryX-${{env.RELEASE_VERSION}}-Android.apk | ||
# - name: Update Tag | ||
# uses: rickstaa/action-create-tag@v1 | ||
# with: | ||
# tag: ${{ env.RELEASE_TAG }} | ||
# force_push_tag: true | ||
- name: Release | ||
uses: softprops/action-gh-release@v2.0.2 | ||
with: | ||
repository: TinyLake/MindustryX-work | ||
token: ${{secrets.PUBLISH_TOKEN}} | ||
tag_name: ${{ env.RELEASE_TAG }} | ||
name: ${{ env.RELEASE_VERSION }} | ||
target_commitish: ${{github.sha}} | ||
files: artifacts/* | ||
prerelease: true | ||
- uses: oven-sh/setup-bun@v1 | ||
- name: clearOldAssets | ||
run: bun run .github/actions/clearOldAssets.ts | ||
env: | ||
GITHUB_TOKEN: ${{secrets.PUBLISH_TOKEN}} | ||
GITHUB_REPOSITORY: TinyLake/MindustryX-work | ||
TAG: ${{ env.RELEASE_TAG }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
/.idea/ | ||
*.iml | ||
/work | ||
/patches/work/ | ||
/patches/work/ | ||
|
||
.gradle/ | ||
build/ |
Oops, something went wrong.