Skip to content

Commit 2de0782

Browse files
committed
ci: Add validation and release workflows
1 parent aff12a4 commit 2de0782

File tree

5 files changed

+121
-8
lines changed

5 files changed

+121
-8
lines changed

.github/actions/setup/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Basic Setup
2+
description: Install Bun and dependencies
3+
runs:
4+
using: composite
5+
steps:
6+
- uses: oven-sh/setup-bun@v1
7+
- run: pnpm install
8+
shell: bash

.github/workflows/release.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
validate:
7+
uses: "./.github/workflows/validate.yml"
8+
9+
publish:
10+
runs-on: ubuntu-22.04
11+
needs:
12+
- validate
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- uses: ./.github/actions/setup
19+
20+
- name: Bump and Tag
21+
run: |
22+
git config user.email "github-actions@users.noreply.github.com"
23+
git config user.name "GitHub Actions"
24+
pnpx changelogen@latest --release
25+
git push
26+
git push --tags
27+
28+
- name: Docker meta
29+
id: meta
30+
uses: docker/metadata-action@v5
31+
with:
32+
images: aklinker1/store-api
33+
tags: |
34+
type=semver,pattern={{version}},value=v${{ steps.bump.outputs.version }}
35+
type=semver,pattern={{major}}.{{minor}},value=v${{ steps.bump.outputs.version }}
36+
37+
- name: Set up QEMU
38+
uses: docker/setup-qemu-action@v3
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
43+
- name: Login to Docker Hub
44+
uses: docker/login-action@v3
45+
with:
46+
username: ${{ secrets.DOCKERHUB_USERNAME }}
47+
password: ${{ secrets.DOCKERHUB_TOKEN }}
48+
49+
- name: Build and push
50+
uses: docker/build-push-action@v5
51+
with:
52+
context: .
53+
platforms: linux/amd64
54+
push: true
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}
57+
58+
- name: Update Production Deployment
59+
run: curl -X POST -i ${{ secrets.UPDATE_PROD_WEBHOOK }}
60+
61+
- name: GitHub Release
62+
run: pnpx changelogen@latest gh release --token ${{ secrets.GITHUB_TOKEN }}

.github/workflows/validate.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Validate
2+
on:
3+
workflow_call:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
formatting:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: ./.github/actions/setup
15+
- run: bun format:check
16+
type-check:
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: ./.github/actions/setup
21+
- run: bun compile
22+
tests:
23+
runs-on: ubuntu-22.04
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: ./.github/actions/setup
27+
- run: bun test

bun.lockb

20.9 KB
Binary file not shown.

package.json

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,36 @@
88
"docker:build": "docker build . -t aklinker1/store-api",
99
"docker:run": "docker run -it aklinker1/store-api",
1010
"docker:build:amd": "bun docker:build --platform linux/amd64",
11-
"docker:push": "bun docker:build --platform linux/amd64 && docker push aklinker1/store-api"
12-
},
13-
"devDependencies": {
14-
"bun-types": "latest",
15-
"code-block-writer": "^12.0.0"
16-
},
17-
"peerDependencies": {
18-
"typescript": "^5.0.0"
11+
"docker:push": "bun docker:build --platform linux/amd64 && docker push aklinker1/store-api",
12+
"postinstall": "simple-git-hooks",
13+
"format": "prettier --write .",
14+
"format:check": "prettier --check .",
15+
"compile": "tsc --noEmit"
1916
},
2017
"dependencies": {
2118
"consola": "^3.2.3",
2219
"dataloader": "^2.2.2",
2320
"graphql": "^16.8.0",
2421
"linkedom": "^0.15.3",
2522
"picocolors": "^1.0.0"
23+
},
24+
"devDependencies": {
25+
"bun-types": "latest",
26+
"code-block-writer": "^12.0.0",
27+
"lint-staged": "^15.2.2",
28+
"prettier": "^3.2.5",
29+
"simple-git-hooks": "^2.9.0",
30+
"typescript": "^5.3.3"
31+
},
32+
"simple-git-hooks": {
33+
"pre-commit": "pnpm lint-staged"
34+
},
35+
"lint-staged": {
36+
"*": "prettier --ignore-unknown --write"
37+
},
38+
"changelog": {
39+
"excludeAuthors": [
40+
"aaronklinker1@gmail.com"
41+
]
2642
}
2743
}

0 commit comments

Comments
 (0)