Browse Source

Added spine-libgdx and spine-ts Github Actions workflows.

badlogic 5 years ago
parent
commit
82433093b4

+ 0 - 17
.github/workflows/main.yml

@@ -1,17 +0,0 @@
-name: CI
-
-on: [push]
-
-jobs:
-  build:
-
-    runs-on: ubuntu-latest
-
-    steps:
-    - uses: actions/checkout@v1
-    - name: Run a one-line script
-      run: echo Hello, world!
-    - name: Run a multi-line script
-      run: |
-        echo Add other actions to build,
-        echo test, and deploy your project.

+ 30 - 0
.github/workflows/settings.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+  <servers>
+    <server>
+      <id>sonatype-nexus-snapshots</id>
+      <username>${env.SONATYPE_USER}</username>
+      <password>${env.SONATYPE_PASSWORD}</password>
+    </server>
+    <server>
+      <id>sonatype-nexus-staging</id>
+      <username>${env.SONATYPE_USER}</username>
+      <password>${env.SONATYPE_PASSWORD}</password>
+    </server>
+  </servers>
+
+  <profiles>
+    <profile>
+      <id>gpg</id>
+      <properties>
+        <gpg.executable>gpg</gpg.executable>
+        <gpg.passphrase>${env.GPG_PASSWORD}</gpg.passphrase>
+      </properties>
+    </profile>
+  </profiles>
+  <activeProfiles>
+    <activeProfile>gpg</activeProfile>
+  </activeProfiles>
+</settings>

+ 24 - 0
.github/workflows/spine-libgdx.yml

@@ -0,0 +1,24 @@
+name: Build spine-libgdx
+
+on:
+  push:
+    paths:
+      - 'spine-libgdx/**'
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v1
+    - name: Set up JDK 1.7
+      uses: actions/setup-java@v1
+      with:
+        java-version: 1.7
+    - name: Build spine-libgdx
+      working-directory: spine-libgdx/spine-libgdx
+      env:
+        SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
+        SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
+      run: mvn -s ../../.github/workflows/settings.xml clean deploy

+ 22 - 0
.github/workflows/spine-ts.yml

@@ -0,0 +1,22 @@
+name: Build spine-ts
+
+on:
+  push:
+    paths:
+      - 'spine-ts/**'
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v1
+    - name: Setup TypeScript
+      uses: actions/setup-node@v1
+      with:
+        node-version: '13.x'
+    - run: npm install -g typescript
+    - name: Build spine-ts
+      working-directory: spine-ts
+      env:
+        TS_UPDATE_URL: ${{secrets.TS_UPDATE_URL}}
+      run: ./build.sh

+ 19 - 1
spine-ts/build.sh

@@ -1,5 +1,14 @@
 #!/bin/sh
-set -e -x
+set -e
+
+if [ -z "$GITHUB_REF" ];
+then
+    BRANCH=$(git symbolic-ref --short -q HEAD)
+else
+    BRANCH=${GITHUB_REF#refs/heads/}
+fi
+
+echo "Building spine-ts $BRANCH artifacts"
 tsc -p tsconfig.json
 tsc -p tsconfig.core.json
 tsc -p tsconfig.webgl.json
@@ -7,3 +16,12 @@ tsc -p tsconfig.canvas.json
 tsc -p tsconfig.threejs.json
 tsc -p tsconfig.player.json
 ls build/*.js build/*.ts | awk '{print "unexpand -t 4 ", $0, " > /tmp/e; mv /tmp/e ", $0}' | sh
+
+if ! [ -z "$TS_UPDATE_URL" ] && ! [ -z "$BRANCH" ];
+then
+    echo "Deploying spine-ts $BRANCH artifacts"
+    zip -j spine-ts.zip build/* player/css/spine-player.css player/example/external/*
+    curl -F "[email protected]" "$TS_UPDATE_URL$BRANCH"
+else
+    echo "Not deploying artifacts. TS_UPDATE_URL and/or BRANCH not set."
+fi