Test #5
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: Test | |
on: | |
workflow_dispatch: | |
jobs: | |
Job_U: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: | | |
npm install -g cytrus-v6 | |
- name: U1 - Get latest dofus version | |
run: | | |
cytrus-v6 download --game dofus --select "VERSION" --output data/U/ | |
- name: Get latest Dofus version | |
run: | | |
export DOFUS_VERSION=$(cat data/U/VERSION) | |
export DATAFUS_VERSION=$(curl https://api.github.com/repos/bot4dofus/Datafus/releases/latest | jq -r ".name") | |
echo The current Dofus version is $DOFUS_VERSION | |
echo The latest Datafus version is $DATAFUS_VERSION | |
echo "::set-env name=DOFUS_VERSION::$DOFUS_VERSION" | |
echo "::set-env name=DATAFUS_VERSION::$DATAFUS_VERSION" | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' | |
- uses: actions/github-script@v6 | |
with: | |
script: | | |
console.log(process.env.DOFUS_VERSION); | |
console.log(process.env.DATAFUS_VERSION); | |
console.log(process.env.DOFUS_VERSION == process.env.DATAFUS_VERSION); | |
if(process.env.DOFUS_VERSION == process.env.DATAFUS_VERSION) { | |
console.log("Dofus and Datafus versions are the same. Stopping the workflow.) | |
const delay = ms => new Promise(res => setTimeout(res, ms)); | |
github.rest.actions.cancelWorkflowRun({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: context.runId | |
}); | |
while (true) { | |
core.info('Waiting for workflow to cancel ...'); | |
await delay(5000); | |
} | |
} | |
- name: U1 - Update Dofus Client | |
run: | | |
cytrus-v6 download --game dofus --select "DofusInvoker.swf,**/*.d2i,**/*.d2o" --output data/U/ | |
ls data/U/ | |
Job_A: | |
runs-on: ubuntu-latest | |
needs: [Job_U] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 |