Skip to content

Commit c960900

Browse files
committed
chore: refactor to simplify usage with single docker image
1 parent 22427c3 commit c960900

File tree

12 files changed

+47
-114
lines changed

12 files changed

+47
-114
lines changed

.github/workflows/docker.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,11 @@ jobs:
2424
uses: docker/setup-qemu-action@v3
2525
- name: Set up Docker Buildx
2626
uses: docker/setup-buildx-action@v3
27-
# - name: Build BitBucket image and push
28-
# uses: docker/build-push-action@v6
29-
# with:
30-
# push: true
31-
# platforms: linux/amd64
32-
# context: ./action
33-
# file: ./action/Dockerfile-bitbucket
34-
# tags: ${{ secrets.DOCKERHUB_USERNAME }}/bitbucket:latest
35-
- name: Build Gitlab image and push
27+
- name: Build BitBucket image and push
3628
uses: docker/build-push-action@v6
3729
with:
3830
push: true
3931
platforms: linux/amd64
4032
context: ./action
41-
file: ./action/Dockerfile-gitlab
42-
tags: ${{ secrets.DOCKERHUB_USERNAME }}/gitlab:v8
33+
file: ./action/Dockerfile
34+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/ci:v11

action/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ RUN npm install -g pnpm && pnpm install
1919
RUN pnpm build
2020

2121
# Run the Node.js / TypeScript application
22-
ENTRYPOINT ["node", "/app/build/github.js"]
22+
ENTRYPOINT ["node", "/app/build/index.js"]

action/Dockerfile-bitbucket

Lines changed: 0 additions & 22 deletions
This file was deleted.

action/Dockerfile-gitlab

Lines changed: 0 additions & 22 deletions
This file was deleted.

action/src/bitbucket.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

action/src/flows/in-branch.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ export class InBranchFlow extends IntegrationFlow {
1717
const hasChanges = this.checkCommitableChanges();
1818
this.ora.succeed(hasChanges ? "Changes detected" : "No changes detected");
1919

20+
execSync(`git status`, { stdio: "inherit" });
21+
execSync(`git branch`, { stdio: "inherit" });
22+
2023
if (hasChanges) {
2124
this.ora.start("Committing changes");
2225
execSync(`git add .`, { stdio: "inherit" });
@@ -26,7 +29,10 @@ export class InBranchFlow extends IntegrationFlow {
2629
this.ora.succeed("Changes committed");
2730

2831
this.ora.start("Pushing changes to remote");
29-
execSync(`git push origin HEAD --force`, { stdio: "inherit" });
32+
execSync(
33+
`git push origin ${this.platformKit.platformConfig.baseBranchName} --force`,
34+
{ stdio: "inherit" },
35+
);
3036
this.ora.succeed("Changes pushed to remote");
3137
}
3238

action/src/github.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

action/src/gitlab.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import createOra from "ora";
33
import { IIntegrationFlow } from "./flows/_base.js";
44
import { PullRequestFlow } from "./flows/pull-request.js";
55
import { InBranchFlow } from "./flows/in-branch.js";
6-
import { PlatformKit } from "./platforms/_base.js";
6+
import { getPlatformKit } from "./platforms/index.js";
77

8-
export async function entrypoint(platformKit: PlatformKit) {
8+
(async function main() {
99
const ora = createOra();
10+
const platformKit = getPlatformKit();
1011
const { isPullRequestMode } = platformKit.config;
1112

1213
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
@@ -20,4 +21,4 @@ export async function entrypoint(platformKit: PlatformKit) {
2021
if (hasChanges) {
2122
await flow.postRun?.();
2223
}
23-
}
24+
})();

action/src/noop.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)