Merge pull request #133 from OpenAF/20250205-204641 #405
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 oJob.io | |
on: | |
push: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
backup: | |
runs-on: ubuntu-latest | |
#permissions: | |
# contents: write | |
# pull-requests: write | |
steps : | |
# -------------------------- | |
- name: Cache OpenAF runtime | |
uses: actions/cache@v4 | |
with: | |
key : oaf-t8 | |
path: /tmp/oaf | |
# -------------------- | |
- name: Backup oJob.io | |
uses: openaf/ojob-action@v6 | |
env : | |
OS_OJOBIO: ${{ secrets.OS_OJOBIO }} | |
with: | |
dist : t8 | |
def : | | |
todo: | |
- Backup ojob.io | |
ojob: | |
opacks : | |
- openaf: 20231222 | |
- S3 : 20231112 | |
catch : printErrnl("[" + job.name + "] "); if (isDef(exception.javaException)) exception.javaException.printStackTrace(); else printErr(exception) | |
logToConsole: true # to change when finished | |
loadLibs : | |
- s3.js | |
owraps : | |
- Format | |
include: | |
- s3.yaml | |
jobs: | |
# --------------------- | |
- name : Backup ojob.io | |
exec : | | |
args._file = io.createTempFile("ojobio", ".zip") | |
// Checking backup download info | |
var _info = $rest().head("https://ojob.io/_output.zip") | |
log("Downloading " + ow.format.toBytesAbbreviation(_info.response["content-length"]) + " modified on " + _info.response["last-modified"] + "...") | |
args._date = new Date(_info.response["last-modified"]) | |
// Downloading backup | |
$rest().get2File(args._file, "https://ojob.io/_output.zip") | |
args._target = "ojobio/ojobio_" + ow.format.fromDate(args._date, "yyyyMMdd-HHmm") + ".zip" | |
args.bucket = "nmaback" | |
args.objectName = args._target | |
args.localPath = args._file | |
to : | |
- (secget ): OS_OJOBIO | |
((secEnv)): true | |
- S3 Put object | |
build: | |
needs : backup | |
runs-on: ubuntu-latest | |
#permissions: | |
# contents: write | |
# pull-requests: write | |
steps : | |
# -------------------------- | |
- name: Cache OpenAF runtime | |
uses: actions/cache@v4 | |
with: | |
key : oaf-t8 | |
path: /tmp/oaf | |
# ------------------------- | |
#- uses: actions/checkout@v2 | |
# -------------------------- | |
- name: Install oJobIO opack | |
uses: openaf/ojob-action@v6 | |
with: | |
dist: t8 | |
def : | | |
todo: | |
- Install aux packs | |
- Copy files | |
- Run Setup oJobIO | |
- Run Rebuild | |
jobs: | |
- name: Install aux packs | |
lang: shell | |
exec: | | |
/tmp/oaf/opack install ojobio | |
/tmp/oaf/opack install ojob-common | |
wget https://ojob.io/_output.zip | |
- name: Copy files | |
lang: shell | |
exec: | | |
cp -R /tmp/oaf/oJobIO/* . | |
ls -lad * | |
find imgs | wc | |
find ojobs | wc | |
echo "__threadPoolFactor=16;" > ~/.openaf_profile | |
- name: Run Setup oJobIO | |
lang: shell | |
typeArgs: | |
shellPrefix: setupOJobIO | |
exec: | | |
/tmp/oaf/ojob setupOJobIO.yaml | |
find ojobs | wc | |
- name: Run Rebuild | |
lang: shell | |
typeArgs: | |
shellPrefix: rebuild | |
exec: | | |
/tmp/oaf/ojob rebuild.yaml NAME=ojob.io URL=ojob.io PROTO=https | |
# ----------------------- | |
- name: Copy build result | |
uses: openaf/ojob-action@v6 | |
env : | |
OS_OJOBIO: ${{ secrets.OS_OJOBIO }} | |
with: | |
dist : t8 | |
def : | | |
ojob: | |
opacks: | |
- S3 | |
include: | |
- s3.yaml | |
todo: | |
- (if ): | | |
io.fileExists("output/oafp.yaml") && io.fileExists("output/oaf/versions.yaml") | |
((then)): | |
- Copy build result | |
((else)): | |
- (fail): -1 | |
jobs: | |
- name: Copy build result | |
to : | |
- (secget) : OS_OJOBIO | |
((secEnv)): true | |
- name: S3 Sync folder | |
args: | |
squash : remote | |
localPath: output | |
bucket : ojob.io | |
execute : true |