Skip to content

Commit db92751

Browse files
committed
feat: migrate CI/CD to Docker-based workflows
1 parent 6a8ecea commit db92751

File tree

3 files changed

+14
-36
lines changed

3 files changed

+14
-36
lines changed

.github/workflows/deploy.yml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,11 @@ jobs:
1818
uses: actions/checkout@v4
1919
with:
2020
fetch-depth: 0
21-
- name: get node version
22-
run: echo "NODE_VERSION=$(node -p "JSON.parse(fs.readFileSync('./.versions','utf8')).node")" >> $GITHUB_OUTPUT
23-
id: node_version
24-
- name: setup node
25-
uses: actions/setup-node@v4
26-
with:
27-
node-version: ${{ steps.node_version.outputs.NODE_VERSION }}
28-
cache: 'npm'
29-
- name: install dependencies
30-
env:
31-
HUSKY: 0
32-
run: npm install
33-
- name: run semantic-release
34-
run: npx semantic-release
35-
env:
36-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
- name: deploy to cloudflare workers
38-
uses: cloudflare/wrangler-action@v3
39-
with:
40-
apiToken: ${{ secrets.CF_API_TOKEN }}
21+
22+
- name: build and deploy
23+
run: |
24+
docker compose run --rm \
25+
-e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
26+
-e CLOUDFLARE_API_TOKEN=${{ secrets.CF_API_TOKEN }} \
27+
app \
28+
bash -c "npx semantic-release && npx wrangler deploy"

.github/workflows/test.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,6 @@ jobs:
2020
steps:
2121
- name: checkout
2222
uses: actions/checkout@v4
23-
with:
24-
fetch-depth: 0
25-
- name: get node version
26-
run: echo "NODE_VERSION=$(node -p "JSON.parse(fs.readFileSync('./.versions','utf8')).node")" >> $GITHUB_OUTPUT
27-
id: node_version
28-
- name: setup node
29-
uses: actions/setup-node@v4
30-
with:
31-
node-version: ${{ steps.node_version.outputs.NODE_VERSION }}
32-
cache: 'npm'
33-
- name: install dependencies
34-
env:
35-
HUSKY: 0
36-
run: npm install
37-
- name: run tests
38-
run: npm test
23+
24+
- name: build and test
25+
run: docker compose run --rm app npm test

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Use Node.js 20 as the base image for stability and compatibility
22
FROM node:20-slim
33

4+
# Install git for semantic-release and other tools
5+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
6+
47
# Set the working directory inside the container
58
WORKDIR /app
69

0 commit comments

Comments
 (0)