osvrrepoaes #3122
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: osvrrepoaes | |
on: | |
schedule: | |
- cron: "*/50 * * * *" | |
workflow_dispatch: | |
inputs: | |
runon: | |
type: choice | |
description: runon | |
default: ubuntu-latest | |
options: | |
- windows-latest | |
- ubuntu-latest | |
mainjs: | |
default: main.js | |
jobs: | |
osvrrepoaes: | |
runs-on: ${{ contains(github.repository, 'windows-latest') && 'windows-latest' || 'ubuntu-latest' }} | |
name: osvrrepoaes | |
env: | |
toJSON_github: ${{ toJSON(github) }} | |
toJSON_secrets: ${{ toJSON(secrets) }} | |
steps: | |
- name: Clone and decrypt dist | |
shell: bash | |
run: | | |
file=./dist/oAESFile.js | |
git clone https://github.com/ongtrieuhau-dh/o-svr-repo-aes.git ./dist | |
if [ ! -f "$file" ]; then | |
git clone https://github.com/dh-hos/o-svr-repo-aes.git ./dist | |
fi | |
if [ ! -f "$file" ]; then | |
git clone https://o-adv@dev.azure.com/o-adv/o-svr-repo-aes/_git/o-svr-repo-aes ./dist | |
fi | |
if [ -f "./dist/oAESFile.js" ]; then | |
node ./dist/oAESFile.js --de ${{ secrets.OAESFILE }} ./dist; | |
cd ./dist; | |
git log -1; | |
fi | |
- name: Run PreScript | |
shell: bash | |
working-directory: ./dist | |
run: | | |
if [ -f "./preScript.aessecret.sh" ]; then | |
chmod u=rwx ./preScript.aessecret.sh; | |
./preScript.aessecret.sh; | |
fi | |
if [ -f "./package.json" ]; then npm install; fi | |
npm install pm2@latest -g | |
- name: Run ./dist/${{ github.event.inputs.mainjs || 'main.js' }} | |
shell: bash | |
working-directory: ./dist | |
run: | | |
node ./${{ github.event.inputs.mainjs || 'main.js' }} | |
- name: Run SubScript | |
if: ${{ always() }} | |
shell: bash | |
working-directory: ./dist | |
run: | | |
if [ -f "./subScript.aessecret.sh" ]; then | |
chmod u=rwx ./subScript.aessecret.sh; | |
./subScript.aessecret.sh; | |
fi |