Specify compose file name defaulting to compose.yaml

This commit is contained in:
Andreas Svanberg 2024-10-30 12:11:45 +01:00
parent 97cee79bb9
commit ec4194b0a9
2 changed files with 6 additions and 1 deletions

@ -9,6 +9,10 @@ inputs:
description: 'The SSH key to use for authentication'
default: ${{ secrets.BRANCH_DEPLOY_KEY }}
required: true
compose-file:
description: 'The Docker Compose file to use'
default: 'compose.yaml'
required: true
outputs:
url:
description: 'The URL of the deployed branch'

@ -11,6 +11,7 @@ async function main() {
const owner = gitea.context.repo.owner;
const serverUrl = gitea.context.serverUrl;
const mangledBranchName = branchName.replace(/\//g, '-').replace(/[^a-zA-Z0-9-]/g, '');
const composeFile = core.getInput('compose-file', {required: true});
core.info(`Branch name: ${branchName}`);
core.info(`Repository name: ${repositoryName}`);
@ -50,7 +51,7 @@ async function main() {
await exec.exec('sh', ['-c', `${pipedCommand}`]);
const deployCommand = `\
echo "${serverUrl}/${owner}/${repositoryName}.git ${branchName} ${mangledBranchName}" | \
echo "${serverUrl}/${owner}/${repositoryName}.git ${branchName} ${mangledBranchName} ${composeFile}" | \
ssh -i ssh_key -o StrictHostKeyChecking=accept-new branch.dsv.su.se`;
const deployment = await exec.getExecOutput('sh', ['-c', deployCommand])
if (deployment.exitCode != 0) {