Skip to content

Commit

Permalink
✨ use bun as package manager and runner for the docke rcontainer, plu…
Browse files Browse the repository at this point in the history
…s some tweak on the github action
  • Loading branch information
Platane authored Feb 20, 2025
1 parent 74bc4f0 commit 85da390
Showing 29 changed files with 26,488 additions and 10,901 deletions.
44 changes: 20 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -8,15 +8,13 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
cache: yarn
node-version: 20
- run: yarn install --frozen-lockfile
- uses: oven-sh/setup-bun@v1

- run: bun install --frozen-lockfile

- run: npm run type
- run: npm run lint
- run: npm run test --ci
- run: bun test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

@@ -46,7 +44,7 @@ jobs:
test -f dist/github-contribution-grid-snake-dark.svg
test -f dist/github-contribution-grid-snake.gif
- uses: crazy-max/ghaction-github-pages@v3.1.0
- uses: crazy-max/ghaction-github-pages@v4.1.0
with:
target_branch: output
build_dir: dist
@@ -57,11 +55,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
cache: yarn
node-version: 20
- run: yarn install --frozen-lockfile
- uses: oven-sh/setup-bun@v1

- run: bun install --frozen-lockfile

- name: build svg-only action
run: |
@@ -84,7 +80,7 @@ jobs:
test -f dist/github-contribution-grid-snake.svg
test -f dist/github-contribution-grid-snake-dark.svg
- uses: crazy-max/ghaction-github-pages@v3.1.0
- uses: crazy-max/ghaction-github-pages@v4.1.0
with:
target_branch: output-svg-only
build_dir: dist
@@ -93,22 +89,22 @@ jobs:

deploy-ghpages:
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
cache: yarn
node-version: 20
- run: yarn install --frozen-lockfile
- uses: oven-sh/setup-bun@v1

- run: bun install --frozen-lockfile

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

- uses: crazy-max/ghaction-github-pages@v3.1.0
if: success() && github.ref == 'refs/heads/main'
- uses: actions/upload-pages-artifact@v3
with:
target_branch: gh-pages
build_dir: packages/demo/dist
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN_GH_PAGES }}
path: packages/demo/dist

- uses: actions/deploy-pages@v4
if: success() && github.ref == 'refs/heads/main'
4 changes: 1 addition & 3 deletions .github/workflows/manual-run.yml
Original file line number Diff line number Diff line change
@@ -37,9 +37,7 @@ jobs:
test -f dist/docker/github-contribution-grid-snake.gif
- name: push github-contribution-grid-snake.svg to the output branch
uses: crazy-max/ghaction-github-pages@v3.1.0
uses: crazy-max/ghaction-github-pages@v4.1.0
with:
target_branch: manual-run-output
build_dir: dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 6 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -45,20 +45,18 @@ jobs:
run: |
sed -i "s/image: .*/image: docker:\/\/platane\/snk@${{ steps.docker-build.outputs.digest }}/" action.yml
- uses: actions/setup-node@v3
with:
cache: yarn
node-version: 20
- uses: oven-sh/setup-bun@v1

- run: bun install --frozen-lockfile

- name: build svg-only action
run: |
yarn install --frozen-lockfile
npm run build:action
rm -r svg-only/dist
mv packages/action/dist svg-only/dist
- name: bump package version
run: yarn version --no-git-tag-version --new-version ${{ github.event.inputs.version }}
run: npm version --no-git-tag-version --new-version ${{ github.event.inputs.version }}

- name: push new build, tag version and push
id: push-tags
@@ -77,13 +75,11 @@ jobs:
git tag v$( echo $VERSION | cut -d. -f 1-2 )
git push origin --tags --force
echo "prerelease=false" >> $GITHUB_OUTPUT
else
else
echo "prerelease=true" >> $GITHUB_OUTPUT
fi
- uses: ncipollo/release-action@v1.12.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ncipollo/release-action@v1.15.0
with:
tag: v${{ github.event.inputs.version }}
body: ${{ github.event.inputs.description }}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules
npm-debug.log*
yarn-error.log*
dist
!svg-only/dist
build
.env
.env
19 changes: 7 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
FROM node:20-slim as builder
FROM oven/bun:1.2.2-slim as builder

WORKDIR /app

COPY package.json yarn.lock ./
COPY package.json bun.lock ./

COPY tsconfig.json ./

COPY packages packages

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

RUN yarn build:action
RUN bun run build:action





FROM node:20-slim
FROM oven/bun:1.2.2-slim

WORKDIR /action-release

RUN export YARN_CACHE_FOLDER="$(mktemp -d)" \
&& yarn add canvas@3.1.0 gifsicle@5.3.0 --no-lockfile \
&& rm -r "$YARN_CACHE_FOLDER"
RUN bun add canvas@3.1.0 gifsicle@5.3.0 --no-lockfile --no-cache

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

CMD ["node", "/action-release/index.js"]

CMD ["bun", "/action-release/index.js"]
Loading

0 comments on commit 85da390

Please sign in to comment.