Skip to content

test

test #181

Workflow file for this run

name: Release Server
on:
push:
branches: ["main"]
workflow_dispatch:
env:
url: https://kotlingames.shop
GH_TOKEN: ${{ github.token }}
permissions:
contents: read
pages: write
id-token: write
jobs:
release:
permissions: write-all
strategy:
matrix:
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: set properties value of server
run: |
setProperty(){
awk -v pat="^$1=" -v value="$1=$2" '{ if ($0 ~ pat) print value; else print $0; }' $3 > $3.tmp
mv $3.tmp $3
}
setProperty "server" "${{ env.url }}" "gradle.properties"
setProperty "version" "v0.0.${{github.run_number}}" "gradle.properties"
- run: git tag ${{github.run_number}}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Buid
run: |
./gradlew :client:jsBrowserProductionWebpack
- name: server.zip
run: ./gradlew :server:distZip
- name: release
uses: marvinpinto/action-automatic-releases@latest
with:
title: "Build #${{github.run_number}}"
automatic_release_tag: "${{github.run_number}}"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
files: server/build/distributions/server.zip
prerelease: false
- shell: bash
run: |
curl -d "${{ secrets.ADMIN_KEY }}" -X POST ${{ env.url }}/shutdown
buildExe:
name: Release .exe
runs-on: windows-latest
permissions: write-all
needs: release
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: set properties value of server
run: |
echo "import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.util.Arrays;import java.util.Iterator;import java.util.Properties;public class Prop { public static void main(String[] args) throws Exception { Iterator<String> iterator = Arrays.stream(args).iterator(); if (!iterator.hasNext()) return; String fileName = iterator.next(); File file = new File(fileName); Properties props = new Properties(); props.load(new FileInputStream(file)); while (true) { if (!iterator.hasNext()) break; String key = iterator.next(); if (!iterator.hasNext()) break; String value = iterator.next(); props.setProperty(key, value); } props.store(new FileOutputStream(file), null); }}" > Prop.java
java Prop.java gradle.properties server ${{ env.url }}
java Prop.java gradle.properties version v0.0.${{github.run_number}}
- run: git tag ${{github.run_number}}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Buid
run: |
# brew install wine-stable
irm get.scoop.sh -outfile 'install.ps1'
.\install.ps1 -RunAsAdmin
scoop install gh
./gradlew :client:linkReleaseExecutableMingwX64
cd client\build\bin\mingwX64
Rename-Item -Path "releaseExecutable" -NewName "client"
cd ..
cd ..
cd ..
cd ..
Compress-Archive -Path .\client\build\bin\mingwX64\client -DestinationPath .\client\build\bin\mingwX64\client.zip
Get-ChildItem -Path . -File -Recurse
gh release upload ${{github.run_number}} .\client\build\bin\mingwX64\client.zip --repo ${{ github.repository }}