Skip to content

Commit cead273

Browse files
Add subfolder support (#34)
1 parent a646082 commit cead273

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ deploy:
3333
GIGALIXIR_APP: my-gigalixir-app # Feel free to also put this in your secrets
3434
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
3535
MIGRATIONS: false # defaults to true
36+
APP_SUBFOLDER: my-app-subfolder # Add only if you want to deploy an app that is not at the root of your repository
3637
```
3738
3839
## Migrations

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ inputs:
1717
description: 'Configuration for migrations'
1818
required: true
1919
default: true
20+
APP_SUBFOLDER:
21+
description: 'Subfolder of your app'
22+
required: false
2023

2124
runs:
2225
using: 'node12'

dist/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,7 @@ async function run() {
10931093
const sshPrivateKey = core.getInput('SSH_PRIVATE_KEY', baseInputOptions);
10941094
const gigalixirApp = core.getInput('GIGALIXIR_APP', baseInputOptions);
10951095
const migrations = core.getInput('MIGRATIONS', baseInputOptions);
1096+
const appSubfolder = core.getInput('APP_SUBFOLDER', { required: false });
10961097

10971098
await core.group("Installing gigalixir", async () => {
10981099
await exec.exec('pip3 install gigalixir')
@@ -1113,7 +1114,11 @@ async function run() {
11131114
core.info(formatReleaseMessage(currentRelease));
11141115

11151116
await core.group("Deploying to gigalixir", async () => {
1116-
await exec.exec("git push -f gigalixir HEAD:refs/heads/master");
1117+
if (appSubfolder) {
1118+
await exec.exec(`git subtree push --prefix ${appSubfolder} gigalixir master`);
1119+
} else {
1120+
await exec.exec("git push -f gigalixir HEAD:refs/heads/master");
1121+
}
11171122
});
11181123

11191124
if (migrations === "true") {

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ async function run() {
8585
const sshPrivateKey = core.getInput('SSH_PRIVATE_KEY', baseInputOptions);
8686
const gigalixirApp = core.getInput('GIGALIXIR_APP', baseInputOptions);
8787
const migrations = core.getInput('MIGRATIONS', baseInputOptions);
88+
const appSubfolder = core.getInput('APP_SUBFOLDER', { required: false });
8889

8990
await core.group("Installing gigalixir", async () => {
9091
await exec.exec('pip3 install gigalixir')
@@ -105,7 +106,11 @@ async function run() {
105106
core.info(formatReleaseMessage(currentRelease));
106107

107108
await core.group("Deploying to gigalixir", async () => {
108-
await exec.exec("git push -f gigalixir HEAD:refs/heads/master");
109+
if (appSubfolder) {
110+
await exec.exec(`git subtree push --prefix ${appSubfolder} gigalixir master`);
111+
} else {
112+
await exec.exec("git push -f gigalixir HEAD:refs/heads/master");
113+
}
109114
});
110115

111116
if (migrations === "true") {

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)