Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
dist/
.env
ready-release-go
22 changes: 9 additions & 13 deletions .woodpecker/test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variables:
- &node_image 'docker.io/node:24-slim'
- &deno_image 'docker.io/denoland/deno:2.9.3'

when:
- event: pull_request
Expand All @@ -9,25 +9,21 @@ when:

steps:
- name: install
image: *node_image
image: *deno_image
commands:
- corepack enable
- pnpm i
- deno install

- name: unit-test
image: *node_image
image: *deno_image
commands:
- corepack enable
- pnpm test
- deno task test

- name: typecheck
image: *node_image
image: *deno_image
commands:
- corepack enable
- pnpm typecheck
- deno task check

- name: format
image: *node_image
image: *deno_image
commands:
- corepack enable
- pnpm format:check
- deno task format:check
32 changes: 19 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
ARG BASE_IMAGE=node:24-slim
ARG DENO_VERSION=2.9.3

FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} AS build
FROM denoland/deno:${DENO_VERSION} AS build
WORKDIR /app
ENV NODE_ENV=production

COPY ["package.json", "pnpm-lock.yaml", "pnpm-workspace.yaml", "./"]
COPY ["package.json", "deno.json", "deno.lock", "./"]
COPY src ./src

RUN corepack enable
RUN pnpm install --frozen-lockfile --package-import-method copy
# Drop devDependencies so only runtime packages are embedded in the binary,
# then let deno resolve and install the remaining npm dependencies.
RUN deno eval 'const p = JSON.parse(Deno.readTextFileSync("package.json")); delete p.devDependencies; Deno.writeTextFileSync("package.json", JSON.stringify(p, null, 2));' \
&& deno install

FROM ${BASE_IMAGE}
RUN deno task compile

# A `FROM scratch` or alpine final stage is not possible: deno compile only
# targets glibc (no musl denort exists), the produced binary is dynamically
# linked, the plugin spawns the git CLI via simple-git, user-defined hooks run
# through /bin/sh (shelljs) and the forge API clients need CA certificates.
# bookworm-slim is the smallest base that provides all of that.
FROM debian:bookworm-slim
WORKDIR /app
ENV NODE_ENV=production

RUN apt update \
&& apt install -y git git-lfs wget \
&& apt install -y --no-install-recommends git git-lfs wget ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY --from=build "/app/node_modules" "./node_modules"
COPY "tsconfig.json" "./tsconfig.json"
COPY "src" "./src"
COPY --from=build /app/ready-release-go /usr/local/bin/ready-release-go

CMD ["/app/node_modules/.bin/tsx", "/app/src/run.ts"]
CMD ["/usr/local/bin/ready-release-go"]
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ Build the Docker image with the following command:
docker build -f Dockerfile -t woodpeckerci/plugin-ready-release-go:next .
```

### Single binary

The plugin can be compiled into a single self-contained binary with
[Deno](https://deno.com/) (>= 2.1):

```sh
deno install
deno task compile
./ready-release-go
```

## Roadmap

- [x] Automatically create release pull-request
Expand Down
15 changes: 15 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"strict": true,
"noUnusedLocals": true
},
"tasks": {
"start": "deno run --allow-all src/run.ts",
"test": "deno run --allow-all npm:vitest run",
"test:watch": "deno run --allow-all npm:vitest --ui --open=false",
"format": "deno run --allow-all npm:prettier --write .",
"format:check": "deno run --allow-all npm:prettier --check .",
"check": "deno check src/run.ts src/index.test.ts src/utils/change.test.ts src/utils/pr.test.ts release-config.ts",
"compile": "deno compile --no-check --allow-all --output ready-release-go src/run.ts"
}
}
Loading