Skip to content

Commit 85da390

Browse files
authored
✨ use bun as package manager and runner for the docke rcontainer, plus some tweak on the github action
1 parent 74bc4f0 commit 85da390

29 files changed

+26488
-10901
lines changed

.github/workflows/main.yml

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ jobs:
88

99
steps:
1010
- uses: actions/checkout@v4
11-
- uses: actions/setup-node@v3
12-
with:
13-
cache: yarn
14-
node-version: 20
15-
- run: yarn install --frozen-lockfile
11+
- uses: oven-sh/setup-bun@v1
12+
13+
- run: bun install --frozen-lockfile
1614

1715
- run: npm run type
1816
- run: npm run lint
19-
- run: npm run test --ci
17+
- run: bun test
2018
env:
2119
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2220

@@ -46,7 +44,7 @@ jobs:
4644
test -f dist/github-contribution-grid-snake-dark.svg
4745
test -f dist/github-contribution-grid-snake.gif
4846
49-
- uses: crazy-max/ghaction-github-pages@v3.1.0
47+
- uses: crazy-max/ghaction-github-pages@v4.1.0
5048
with:
5149
target_branch: output
5250
build_dir: dist
@@ -57,11 +55,9 @@ jobs:
5755
runs-on: ubuntu-latest
5856
steps:
5957
- uses: actions/checkout@v4
60-
- uses: actions/setup-node@v3
61-
with:
62-
cache: yarn
63-
node-version: 20
64-
- run: yarn install --frozen-lockfile
58+
- uses: oven-sh/setup-bun@v1
59+
60+
- run: bun install --frozen-lockfile
6561

6662
- name: build svg-only action
6763
run: |
@@ -84,7 +80,7 @@ jobs:
8480
test -f dist/github-contribution-grid-snake.svg
8581
test -f dist/github-contribution-grid-snake-dark.svg
8682
87-
- uses: crazy-max/ghaction-github-pages@v3.1.0
83+
- uses: crazy-max/ghaction-github-pages@v4.1.0
8884
with:
8985
target_branch: output-svg-only
9086
build_dir: dist
@@ -93,22 +89,22 @@ jobs:
9389

9490
deploy-ghpages:
9591
runs-on: ubuntu-latest
92+
permissions:
93+
pages: write
94+
id-token: write
9695
steps:
9796
- uses: actions/checkout@v4
98-
- uses: actions/setup-node@v3
99-
with:
100-
cache: yarn
101-
node-version: 20
102-
- run: yarn install --frozen-lockfile
97+
- uses: oven-sh/setup-bun@v1
98+
99+
- run: bun install --frozen-lockfile
103100

104101
- run: npm run build:demo
105102
env:
106103
GITHUB_USER_CONTRIBUTION_API_ENDPOINT: https://snk-one.vercel.app/api/github-user-contribution/
107104

108-
- uses: crazy-max/[email protected]
109-
if: success() && github.ref == 'refs/heads/main'
105+
- uses: actions/upload-pages-artifact@v3
110106
with:
111-
target_branch: gh-pages
112-
build_dir: packages/demo/dist
113-
env:
114-
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN_GH_PAGES }}
107+
path: packages/demo/dist
108+
109+
- uses: actions/deploy-pages@v4
110+
if: success() && github.ref == 'refs/heads/main'

.github/workflows/manual-run.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ jobs:
3737
test -f dist/docker/github-contribution-grid-snake.gif
3838
3939
- name: push github-contribution-grid-snake.svg to the output branch
40-
uses: crazy-max/ghaction-github-pages@v3.1.0
40+
uses: crazy-max/ghaction-github-pages@v4.1.0
4141
with:
4242
target_branch: manual-run-output
4343
build_dir: dist
44-
env:
45-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,18 @@ jobs:
4545
run: |
4646
sed -i "s/image: .*/image: docker:\/\/platane\/snk@${{ steps.docker-build.outputs.digest }}/" action.yml
4747
48-
- uses: actions/setup-node@v3
49-
with:
50-
cache: yarn
51-
node-version: 20
48+
- uses: oven-sh/setup-bun@v1
49+
50+
- run: bun install --frozen-lockfile
5251

5352
- name: build svg-only action
5453
run: |
55-
yarn install --frozen-lockfile
5654
npm run build:action
5755
rm -r svg-only/dist
5856
mv packages/action/dist svg-only/dist
5957
6058
- name: bump package version
61-
run: yarn version --no-git-tag-version --new-version ${{ github.event.inputs.version }}
59+
run: npm version --no-git-tag-version --new-version ${{ github.event.inputs.version }}
6260

6361
- name: push new build, tag version and push
6462
id: push-tags
@@ -77,13 +75,11 @@ jobs:
7775
git tag v$( echo $VERSION | cut -d. -f 1-2 )
7876
git push origin --tags --force
7977
echo "prerelease=false" >> $GITHUB_OUTPUT
80-
else
78+
else
8179
echo "prerelease=true" >> $GITHUB_OUTPUT
8280
fi
8381
84-
- uses: ncipollo/[email protected]
85-
env:
86-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
- uses: ncipollo/[email protected]
8783
with:
8884
tag: v${{ github.event.inputs.version }}
8985
body: ${{ github.event.inputs.description }}

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
node_modules
22
npm-debug.log*
3-
yarn-error.log*
43
dist
54
!svg-only/dist
65
build
7-
.env
6+
.env

Dockerfile

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,27 @@
1-
FROM node:20-slim as builder
1+
FROM oven/bun:1.2.2-slim as builder
22

33
WORKDIR /app
44

5-
COPY package.json yarn.lock ./
5+
COPY package.json bun.lock ./
66

77
COPY tsconfig.json ./
88

99
COPY packages packages
1010

11-
RUN export YARN_CACHE_FOLDER="$(mktemp -d)" \
12-
&& yarn install --frozen-lockfile \
13-
&& rm -r "$YARN_CACHE_FOLDER"
11+
RUN bun install --no-cache
1412

15-
RUN yarn build:action
13+
RUN bun run build:action
1614

1715

1816

1917

2018

21-
FROM node:20-slim
19+
FROM oven/bun:1.2.2-slim
2220

2321
WORKDIR /action-release
2422

25-
RUN export YARN_CACHE_FOLDER="$(mktemp -d)" \
26-
&& yarn add [email protected] [email protected] --no-lockfile \
27-
&& rm -r "$YARN_CACHE_FOLDER"
23+
RUN bun add [email protected] [email protected] --no-lockfile --no-cache
2824

2925
COPY --from=builder /app/packages/action/dist/ /action-release/
3026

31-
CMD ["node", "/action-release/index.js"]
32-
27+
CMD ["bun", "/action-release/index.js"]

0 commit comments

Comments
 (0)