Skip to content

Commit 2f3acd4

Browse files
ci: build Docker images and check the npm package before merge (#1398)
Dockerfile, Dockerfile.release, docker/** and npm-distribution/** had no pre-merge check: goreleaser.yml and docker.yml only run on release tags, and renovate automerges on green CI. Two path-filtered workflows now build every shipped image (with the same static linux binary goreleaser feeds to Dockerfile.release) and run npm ci + npm pack on the npm package. Amp-Thread-ID: https://ampcode.com/threads/T-01a1a37e-8603-775d-bc85-c5677817f7a8 Co-authored-by: Amp <amp@ampcode.com>
1 parent 0d0128d commit 2f3acd4

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

‎.github/workflows/docker-check.yml‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Builds every Docker image this repo ships. Nothing else tests them before a
2+
# tag: .goreleaser.yml and docker.yml only run on release tags.
3+
name: Docker check
4+
5+
on:
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- Dockerfile
10+
- Dockerfile.release
11+
- .dockerignore
12+
- docker/**
13+
- .github/workflows/docker-check.yml
14+
15+
jobs:
16+
src-cli-image:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v7
21+
- name: Get Go version from mise
22+
id: mise
23+
run: echo "go-version=$(grep 'golang' mise.toml | cut -d'"' -f2)" >> "$GITHUB_OUTPUT"
24+
- name: Set up Go
25+
uses: actions/setup-go@v7
26+
with:
27+
go-version: ${{ steps.mise.outputs.go-version }}
28+
cache: false
29+
# Dockerfile.release expects the static linux binary goreleaser builds
30+
# into the project root.
31+
- name: Build src like goreleaser does
32+
run: CGO_ENABLED=0 GOOS=linux go build -o src ./cmd/src
33+
- name: Build Dockerfile.release
34+
run: docker build --file Dockerfile.release --tag src-cli:release .
35+
- run: docker run --rm src-cli:release version --client-only
36+
- name: Build Dockerfile
37+
run: docker build --tag src-cli:dev .
38+
- run: docker run --rm src-cli:dev version --client-only
39+
40+
batch-change-volume-workspace-image:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v7
45+
- name: Build docker/batch-change-volume-workspace
46+
run: docker build --tag volume-workspace docker/batch-change-volume-workspace
47+
- run: docker run --rm volume-workspace sh -c 'git --version && unzip -v'

‎.github/workflows/npm-check.yml‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Checks the npm package that goreleaser.yml publishes on release tags.
2+
name: npm check
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
paths:
8+
- npm-distribution/**
9+
- .github/workflows/npm-check.yml
10+
11+
jobs:
12+
npm-check:
13+
runs-on: ubuntu-latest
14+
defaults:
15+
run:
16+
working-directory: npm-distribution
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v7
20+
# The install script downloads the release binary for package.json's
21+
# version, which does not exist until the tag is published.
22+
- run: npm ci --ignore-scripts
23+
- run: node -e 'require("tar")'
24+
# Runs the prepack script and lists what would ship.
25+
- run: npm pack --dry-run

0 commit comments

Comments
 (0)