Skip to content

Commit

Permalink
Fix first render
Browse files Browse the repository at this point in the history
Resolves: #364
  • Loading branch information
ggodlewski committed Sep 23, 2023
1 parent 5978f41 commit da84c69
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 4 deletions.
1 change: 1 addition & 0 deletions apps/wgd-action-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ADD site/ /site
ENV BASE_URL=http://example.com/
ENV THEME_ID=""
ENV THEME_URL=""
ENV NO_COLOR="true"

VOLUME ["/site/content"]
VOLUME ["/site/public"]
Expand Down
3 changes: 2 additions & 1 deletion apps/wgd-action-runner/steps/step_render_hugo
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ then
fi

cat /site/tmp_dir/config.toml
hugo --config="$CONFIG_TOML" --verbose --baseURL="$BASE_URL"
#hugo --logLevel debug --config="$CONFIG_TOML" --baseURL="$BASE_URL"
hugo --logLevel info --config="$CONFIG_TOML" --baseURL="$BASE_URL"

CODE=$?

Expand Down
18 changes: 18 additions & 0 deletions src/containers/action/ActionRunnerContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ export const DEFAULT_ACTIONS: ActionDefinition[] = [
uses: 'push_branch'
}
]
},
{
on: 'git_reset',
steps: [
{
name: 'render_hugo',
uses: 'render_hugo',
}
]
},
{
on: 'git_pull',
steps: [
{
name: 'render_hugo',
uses: 'render_hugo',
}
]
}
];

Expand Down
14 changes: 11 additions & 3 deletions src/containers/google_folder/UserConfigService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ export class UserConfig {
actions_yaml?: string;
}

const DEFAULT_CONFIG: UserConfig = {
remote_branch: 'master',
hugo_theme: {
id: 'ananke',
name: 'Anake',
url: 'https://github.com/budparr/gohugo-theme-ananke.git',
preview_img: 'https://raw.githubusercontent.com/budparr/gohugo-theme-ananke/master/images/screenshot.png'
}
};

export class UserConfigService {

public config: UserConfig;
Expand All @@ -53,9 +63,7 @@ export class UserConfigService {
const json = await this.fileService.readJson('.user_config.json');
this.config = json || {};
} else {
this.config = {
remote_branch: 'master'
};
this.config = structuredClone(DEFAULT_CONFIG);
await this.save();
}
if (!this.config.actions_yaml) {
Expand Down
12 changes: 12 additions & 0 deletions src/containers/job/JobManagerContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,12 @@ export class JobManagerContainer extends Container {
privateKeyFile: await userConfigService.getDeployPrivateKeyPath()
});

await this.schedule(driveId, {
type: 'run_action',
title: 'Run action: on git_pull',
trigger: 'git_pull'
});

return {};
} catch (err) {
logger.error(err.stack ? err.stack : err.message);
Expand Down Expand Up @@ -699,6 +705,12 @@ export class JobManagerContainer extends Container {
}
break;
}

await this.schedule(driveId, {
type: 'run_action',
title: 'Run action: on git_reset',
trigger: 'git_reset'
});
} catch (err) {
logger.error(err.message);
if (err.message.indexOf('Failed to retrieve list of SSH authentication methods') > -1) {
Expand Down

0 comments on commit da84c69

Please sign in to comment.