Upgrade to 1.2.1 #35
Workflow file for this run
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: Build | |
on: [ pull_request, push ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Grant execute permission for all runners | |
run: chmod +x gradlew | |
- name: build | |
run: ./gradlew build | |
# Upload part | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install NPM package | |
run: npm install @actions/artifact | |
- uses: actions/github-script@v6 | |
name: Artifact script | |
with: | |
script: | | |
let artifact = require('@actions/artifact'); | |
const fs = require('fs'); | |
function getContentFrom(path, check) { | |
return fs.readdirSync(path).filter(function (file) { | |
return check == fs.statSync(path+'/'+file).isDirectory(); | |
}); | |
} | |
function getDirectories(path) { return getContentFrom(path, true); } | |
function getFiles(path) { return getContentFrom(path, false); } | |
const artifactClient = artifact.create(); | |
for(let fabricVersion of getDirectories("./")) { | |
if(!fabricVersion.startsWith("fabric")) | |
continue; | |
console.log("Checking for version", fabricVersion); | |
let visual = ""; | |
for(let char of fabricVersion.replace("fabric", "")) { | |
if(visual.length > 0 && visual.length % 2 == 0) { | |
visual += "."; | |
} | |
visual += char; | |
} | |
let filesDir = "./" + fabricVersion + "/build/libs"; | |
let files = []; | |
for(let build of getFiles(filesDir)) { | |
if(!build.endsWith("-sources.jar")) { | |
files.push(filesDir + "/" + build); | |
} | |
} | |
console.log("Uploading version", "1." + visual, "and files", files); | |
await artifactClient.uploadArtifact( | |
"NegativityFabric 1." + visual, | |
files, | |
filesDir, | |
{ continueOnError: false } | |
) | |
} |