Compare commits

...

3 Commits

Author SHA1 Message Date
Platane
372b3e70f5 📦 1.0.2-rc.2 2022-03-24 10:10:04 +00:00
platane
67c66ac8ae 👷 2022-03-24 11:04:01 +01:00
platane
c97378f175 👷 2022-03-24 10:59:43 +01:00
23 changed files with 61778 additions and 51 deletions

View File

@@ -33,12 +33,16 @@ jobs:
test-action:
runs-on: ubuntu-latest
needs: build-docker-image
steps:
- uses: actions/checkout@v2
- name: update action.yml
run: |
sed -i "s/image: .*/image: Dockerfile/" action.yml
- name: generate-snake-game-from-github-contribution-grid
id: snake-gif
uses: Platane/snk@master
id: generate-snake
uses: ./
with:
github_user_name: platane
gif_out_path: dist/github-contribution-grid-snake.gif
@@ -46,15 +50,16 @@ jobs:
- name: ensure the generated file exists
run: |
ls -l ${{ steps.snake-gif.outputs.gif_out_path }}
test -f ${{ steps.snake-gif.outputs.gif_out_path }}
ls dist
test -f ${{ steps.generate-snake.outputs.gif_out_path }}
test -f ${{ steps.generate-snake.outputs.svg_out_path }}
- uses: crazy-max/ghaction-github-pages@v2.5.0
with:
target_branch: output
build_dir: dist
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN_GH_PAGES }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy-ghpages:
runs-on: ubuntu-latest
@@ -70,41 +75,10 @@ jobs:
env:
GITHUB_USER_CONTRIBUTION_API_ENDPOINT: https://snk-one.vercel.app/api/github-user-contribution/
- uses: crazy-max/ghaction-github-pages@v2.5.0
- uses: crazy-max/ghaction-github-pages@v2.6.0
if: success() && github.ref == 'refs/heads/master'
with:
target_branch: gh-pages
build_dir: packages/demo/dist
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN_GH_PAGES }}
build-docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
cache: yarn
node-version: 16
- run: yarn install --frozen-lockfile
- run: yarn build:action
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v2
id: docker_build
with:
push: ${{ github.ref == 'refs/heads/master' }}
tags: |
platane/snk:latest
platane/snk:${{ github.sha }}
file: packages/action/Dockerfile
context: packages/action

75
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,75 @@
name: release
on:
workflow_dispatch:
inputs:
version:
description: "Version"
default: "0.0.1"
required: true
type: string
description:
description: "Version description"
type: string
prerelease:
description: "Prerelease"
default: false
required: true
type: boolean
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v2
id: docker-build
with:
push: true
tags: |
platane/snk:${{ github.sha }}
platane/snk:${{ github.event.inputs.version }}
- name: update action.yml
run: |
sed -i "s/image: .*/image: docker:\/\/platane\/snk:${{ steps.docker-build.outputs.digest }}/" action.yml
- uses: actions/setup-node@v2
with:
cache: yarn
node-version: 16
- name: bump version
run: yarn version --no-git-tag-version --new-version ${{ github.event.inputs.version }}
- name: build svg-only action
run: |
yarn install --frozen-lockfile
yarn build:demo
mv packages/demo/dist/* svg-only/
- name: push new commit
uses: EndBug/add-and-commit@v7
with:
add: package.json svg-only action.yml
message: 📦 ${{ github.event.inputs.version }}
tag: v${{ github.event.inputs.version }}
- uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.version }}
# release_name: Release ${{ github.event.inputs.version }}
body: ${{ github.event.inputs.description }}
prerelease: ${{ github.event.inputs.prerelease }}

32
Dockerfile Normal file
View File

@@ -0,0 +1,32 @@
FROM node:16-slim as builder
WORKDIR /app
COPY package.json yarn.lock ./
COPY tsconfig.json ./
COPY packages packages
RUN export YARN_CACHE_FOLDER="$(mktemp -d)" \
&& yarn install --frozen-lockfile \
&& rm -r "$YARN_CACHE_FOLDER"
RUN yarn build:action
FROM node:16-slim
WORKDIR /action-release
RUN export YARN_CACHE_FOLDER="$(mktemp -d)" \
&& yarn add canvas@2.9.1 gifsicle@5.3.0 --no-lockfile \
&& rm -r "$YARN_CACHE_FOLDER"
COPY --from=builder /app/packages/action/dist/ /action-release/
CMD ["node", "/action-release/index.js"]

View File

@@ -3,8 +3,8 @@ description: "Generates a snake game from a github user contributions grid. Outp
author: "platane"
runs:
using: "docker"
image: "docker://platane/snk:latest"
using: docker
image: docker://platane/snk:sha256:a8082dd35baa9da91c686c7a7f25eb4f7216f5ab0cafe8cdec486994539bbe9d
inputs:
github_user_name:

View File

@@ -1,7 +1,7 @@
{
"name": "snk",
"description": "Generates a snake game from a github user contributions grid",
"version": "1.0.0",
"version": "1.0.2-rc.2",
"private": true,
"repository": "github:platane/snk",
"devDependencies": {

View File

@@ -1,9 +0,0 @@
FROM node:16-slim
WORKDIR /github/snk
RUN npm install canvas@2.8.0 gifsicle@5.2.0 --no-save --no-package-lock
COPY dist /github/snk/
CMD ["node", "/github/snk/index.js"]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

9
svg-only/README.md Normal file
View File

@@ -0,0 +1,9 @@
# svg-only
Another action running purely on js (without Docker).
As a drawback, it can not generate gif image.
## Build process
file is built and push on release, by the release action.

20
svg-only/action.yml Normal file
View File

@@ -0,0 +1,20 @@
name: "generate-snake-game-from-github-contribution-grid"
description: "Generates a snake game from a github user contributions grid. Output the animation as svg"
author: "platane"
runs:
using: node16
main: index.js
inputs:
github_user_name:
description: "github user name"
required: true
svg_out_path:
description: "path of the generated svg file. If left empty, the svg file will not be generated."
required: false
default: null
outputs:
svg_out_path:
description: "path of the generated svg"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>snk - getBestRoute</title>
<meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="f76fcb720ebb4f9b7094.js"></script></head>
<body>
</body>
</html>

View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>snk - getBestTunnel</title>
<meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="58f1a430b6e288bd0c55.js"></script></head>
<body>
</body>
</html>

9
svg-only/getPathTo.html Normal file
View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>snk - getPathTo</title>
<meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="c10a4b0e515483329a49.js"></script></head>
<body>
</body>
</html>

View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>snk - getPathToPose</title>
<meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="7587fb72ce536dc8c3d6.js"></script></head>
<body>
</body>
</html>

9
svg-only/index.html Normal file
View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>snk - interactive</title>
<meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="65edc0d25be3835439de.js"></script></head>
<body>
</body>
</html>

View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>snk - interactive</title>
<meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="65edc0d25be3835439de.js"></script></head>
<body>
</body>
</html>

9
svg-only/outside.html Normal file
View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>snk - outside</title>
<meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="7b4f83fb850c5eebc0f6.js"></script></head>
<body>
</body>
</html>

9
svg-only/svg.html Normal file
View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>snk - svg</title>
<meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="6226f1a03620966f189a.js"></script></head>
<body>
</body>
</html>