Release #37
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
name: Release | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
need_update: ${{ env.json_Update }} | |
filename: ${{ env.json_FileName }} | |
content: ${{ env.json_Body }} | |
title: ${{ env.json_Title }} | |
version: ${{ env.json_Version }} | |
prerelease: ${{ env.json_PreRelease }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup Node.js 14 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14.x | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: "temurin" | |
- name: Configure git credentials | |
uses: OleksiyRudenko/gha-git-credentials@v2.1.1 | |
with: | |
global: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check Version and Build | |
env: | |
GH_REPO: ${{ github.repository }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm install | |
npm start | |
- name: Load output file to env | |
uses: antifree/json-to-variables@v1.0.1 | |
with: | |
filename: output.json | |
- name: Upload Artifacts | |
if: ${{ env.json_Update == 'true' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: package | |
path: | | |
${{ env.json_FileName }} | |
README_zh.md | |
release-github: | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ needs.build.outputs.need_update == 'true' }} | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: package | |
- name: Create Release on Github | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: ${{ needs.build.outputs.filename }} | |
body: ${{ needs.build.outputs.content }} | |
name: ${{ needs.build.outputs.title }} | |
tag: ${{ needs.build.outputs.version }} | |
prerelease: ${{ needs.build.outputs.prerelease }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-3dm: | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ needs.build.outputs.need_update == 'true' && github.repository_owner == 'Nats-ji' }} | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: package | |
- name: Update into on 3dm | |
uses: GlossMod/ActionUpdateMod@v1 | |
id: update_3dm | |
with: | |
appid: ${{ secrets.APPID_3DM }} | |
appkey: ${{ secrets.APPKEY_3DM }} | |
id: ${{ secrets.MODID_3DM }} | |
version: ${{ needs.build.outputs.version }} | |
content: README_zh.md | |
file: ${{ needs.build.outputs.filename }} | |
zip-only: true | |
- name: Upload file to 3dm | |
id: uploadFile | |
continue-on-error: true | |
uses: Nats-ji/Action3DMLargeFileUpload@v1 | |
with: | |
username: ${{ secrets.USERNAME_3DM }} | |
password: ${{ secrets.PASSWORD_3DM }} | |
cookies: ${{ secrets.COOKIES_3DM }} | |
id: ${{ secrets.MODID_3DM }} | |
file: ${{ steps.update_3dm.outputs.file }} | |
filename: paper-sand-dupe-unpatched-${{ needs.build.outputs.version }} | |
# hacky way to retry after failing to upload | |
- name: Upload file to 3dm 1st retry | |
id: uploadFileRetry1 | |
if: steps.uploadFile.outcome == 'failure' | |
continue-on-error: true | |
uses: Nats-ji/Action3DMLargeFileUpload@v1 | |
with: | |
username: ${{ secrets.USERNAME_3DM }} | |
password: ${{ secrets.PASSWORD_3DM }} | |
cookies: ${{ secrets.COOKIES_3DM }} | |
id: ${{ secrets.MODID_3DM }} | |
file: ${{ steps.update_3dm.outputs.file }} | |
filename: paper-sand-dupe-unpatched-${{ needs.build.outputs.version }} | |
- name: Upload file to 3dm 2nd retry | |
id: uploadFileRetry2 | |
if: steps.uploadFileRetry1.outcome == 'failure' | |
uses: Nats-ji/Action3DMLargeFileUpload@v1 | |
with: | |
username: ${{ secrets.USERNAME_3DM }} | |
password: ${{ secrets.PASSWORD_3DM }} | |
cookies: ${{ secrets.COOKIES_3DM }} | |
id: ${{ secrets.MODID_3DM }} | |
file: ${{ steps.update_3dm.outputs.file }} | |
filename: paper-sand-dupe-unpatched-${{ needs.build.outputs.version }} |