-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
175 additions
and
666 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
/// <reference types="node" /> | ||
/* eslint-env node */ | ||
/* global fetch, process */ | ||
/* eslint-disable no-console */ | ||
|
||
const payload = { | ||
sender: 'github-actions', | ||
type: process.env.EAS_WORKFLOW_TYPE, | ||
branch: process.env.BRANCH_NAME, | ||
domain: process.env.EXPO_PUBLIC_ASSOCIATED_DOMAIN, | ||
last_commit_message: process.env.LAST_COMMIT_MESSAGE, | ||
comment: process.env.WORFLOW_COMMENT_INPUT ?? null, | ||
env: process.env.WORKFLOW_ENVIRONMENT, | ||
} | ||
|
||
const requestOptions = { | ||
method: 'PUT', | ||
headers: { 'Content-Type': 'application/json' }, | ||
body: JSON.stringify({ | ||
channel: "#app-livraison", | ||
text: `Déploiement terminé du projet mobile (${process.env.BRANCH_NAME}) sur : ${process.env.URL.replace('"', '').replace('\"', '')}` | ||
}) | ||
}; | ||
method: 'POST', | ||
headers: { 'Content-Type': 'application/json' }, | ||
body: JSON.stringify(payload), | ||
} | ||
|
||
fetch(process.env.SLACK_WEBHOOK_URL, requestOptions) | ||
fetch(process.env.MAKE_WEBHOOK_URL, requestOptions) |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/// <reference types="node" /> | ||
/* eslint-env node */ | ||
/* global console, process */ | ||
/* eslint-disable no-console */ | ||
|
||
import {exec} from 'child_process' | ||
import {promisify} from 'util' | ||
import chalk from 'chalk' | ||
import appJson from '../../app.json' assert {type: 'json'} | ||
import {fileURLToPath} from 'url' | ||
import {program} from "commander"; | ||
|
||
/* | ||
This app simplify the build run instead of running it directly on bash | ||
*/ | ||
|
||
|
||
const aExec = promisify(exec) | ||
const candidate = appJson.expo.version | ||
|
||
// Declare non available features un mJS | ||
const __filename = fileURLToPath(import.meta.url) | ||
|
||
|
||
async function actionHandler() { | ||
try { | ||
console.log('REF TYPE IS', process.env.REF_TYPE, '\n') | ||
switch (process.env.EAS_WORKFLOW_TYPE) { | ||
case 'update': { | ||
console.log(chalk.magenta(`Will do an UPDATE on expo runtime version ${candidate}.`)) | ||
const expoUpdateCommandBase = `eas update --auto` | ||
await aExec(expoUpdateCommandBase) | ||
process.exit(0) | ||
break; | ||
} | ||
case 'build': { | ||
const expoCommandBase = `eas build --platform all --non-interactive --no-wait` | ||
if (process.env.WORKFLOW_ENVIRONMENT === 'production') { | ||
console.log(chalk.magenta('Will do a build on production env...')) | ||
await aExec(`${expoCommandBase} --profile production --auto-submit`) | ||
process.exit(0) | ||
} | ||
if (process.env.WORKFLOW_ENVIRONMENT === 'staging') { | ||
console.log(chalk.blue('Will do a build on staging env...')) | ||
await aExec(`${expoCommandBase} --profile staging`) | ||
process.exit(0) | ||
} | ||
console.log(chalk.red(`Unknown WORKFLOW_ENVIRONMENT ${process.env.WORKFLOW_ENVIRONMENT}`)) | ||
process.exit(2) | ||
break; | ||
} | ||
default: { | ||
console.log(chalk.red(`Unknown EAS_WORKFLOW_TYPE ${process.env.EAS_WORKFLOW_TYPE}`)) | ||
process.exit(2) | ||
} | ||
} | ||
} catch (error) { | ||
if (error instanceof Error) { | ||
console.log(chalk.red(error.message)) | ||
} else { | ||
console.log(chalk.red('Unknown error')) | ||
} | ||
process.exit(3) | ||
} | ||
|
||
|
||
} | ||
|
||
|
||
program | ||
.description('This app simplify the build run instead of running it directly on bash') | ||
.action(actionHandler) | ||
.parse() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.