🚀 fix action
This commit is contained in:
8
.github/workflows/deploy.yml
vendored
8
.github/workflows/deploy.yml
vendored
@@ -6,22 +6,22 @@ on:
|
|||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
deploy-demo:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1.4.2
|
||||||
with:
|
with:
|
||||||
node-version: 14
|
node-version: 14
|
||||||
|
|
||||||
- uses: bahmutov/npm-install@v1
|
- uses: bahmutov/npm-install@v1.4.1
|
||||||
|
|
||||||
- run: yarn build:demo
|
- run: yarn build:demo
|
||||||
env:
|
env:
|
||||||
BASE_PATHNAME: "snk"
|
BASE_PATHNAME: "snk"
|
||||||
|
|
||||||
- uses: crazy-max/ghaction-github-pages@068e494
|
- uses: crazy-max/ghaction-github-pages@v2.1.1
|
||||||
with:
|
with:
|
||||||
target_branch: gh-pages
|
target_branch: gh-pages
|
||||||
build_dir: packages/demo/dist
|
build_dir: packages/demo/dist
|
||||||
|
|||||||
30
.github/workflows/main.yml
vendored
30
.github/workflows/main.yml
vendored
@@ -9,12 +9,38 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- run: sudo apt-get install gifsicle graphicsmagick
|
- run: sudo apt-get install gifsicle graphicsmagick
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1.4.2
|
||||||
with:
|
with:
|
||||||
node-version: 14
|
node-version: 14
|
||||||
|
|
||||||
- uses: bahmutov/npm-install@v1
|
- uses: bahmutov/npm-install@v1.4.1
|
||||||
|
|
||||||
- run: yarn type
|
- run: yarn type
|
||||||
- run: yarn lint
|
- run: yarn lint
|
||||||
- run: yarn test --ci
|
- run: yarn test --ci
|
||||||
|
- run: yarn build:action
|
||||||
|
|
||||||
|
test-action:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- run: mkdir dist
|
||||||
|
|
||||||
|
- name: generate-snake-game-from-github-contribution-grid
|
||||||
|
id: snake-gif
|
||||||
|
uses: Platane/snk@master
|
||||||
|
with:
|
||||||
|
github_user_name: platane
|
||||||
|
gif_out_path: dist/github-contribution-grid-snake.gif
|
||||||
|
|
||||||
|
- 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 }}
|
||||||
|
|
||||||
|
- uses: crazy-max/ghaction-github-pages@v2.1.1
|
||||||
|
with:
|
||||||
|
target_branch: output
|
||||||
|
build_dir: dist
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN_GH_PAGES }}
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,4 +2,5 @@ node_modules
|
|||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
dist
|
dist
|
||||||
build
|
build
|
||||||
|
out.gif
|
||||||
13
Dockerfile
13
Dockerfile
@@ -4,7 +4,16 @@ RUN apt-get update \
|
|||||||
&& apt-get install -y --no-install-recommends gifsicle graphicsmagick \
|
&& apt-get install -y --no-install-recommends gifsicle graphicsmagick \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY packages/action/dist/* ./github-contribution-grid-snake
|
COPY tsconfig.json package.json yarn.lock /github/snk/
|
||||||
|
COPY packages /github/snk/packages
|
||||||
|
|
||||||
CMD ["node", "github-contribution-grid-snake/index.js"]
|
RUN ( \
|
||||||
|
cd /github/snk \
|
||||||
|
&& find . \
|
||||||
|
&& yarn install --frozen-lockfile \
|
||||||
|
&& yarn build:action \
|
||||||
|
&& mv packages/action/dist/* . \
|
||||||
|
&& rm -rf packages tsconfig.json package.json yarn.lock node_modules \
|
||||||
|
)
|
||||||
|
|
||||||
|
CMD ["node", "/github/snk/index.js"]
|
||||||
|
|||||||
13
action.yml
13
action.yml
@@ -1,23 +1,20 @@
|
|||||||
name: "github-contribution-grid-snake"
|
name: "generate-snake-game-from-github-contribution-grid"
|
||||||
description: ""
|
description: "Generates a snake game from a github user contributions grid and output a screen capture as gif"
|
||||||
author: "platane"
|
author: "platane"
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
gif_out_path:
|
gif_out_path:
|
||||||
description: ""
|
description: "path of the generated gif"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "docker"
|
using: "docker"
|
||||||
image: "Dockerfile"
|
image: "Dockerfile"
|
||||||
args:
|
|
||||||
- ${{ inputs.github_user_name }}
|
|
||||||
- ${{ inputs.gif_out_path }}
|
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
github_user_name:
|
github_user_name:
|
||||||
description: ""
|
description: "github user name"
|
||||||
required: true
|
required: true
|
||||||
gif_out_path:
|
gif_out_path:
|
||||||
description: ""
|
description: "path of the generated gif"
|
||||||
required: false
|
required: false
|
||||||
default: "./github-contribution-grid-snake.gif"
|
default: "./github-contribution-grid-snake.gif"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "snk",
|
"name": "snk",
|
||||||
|
"description": "Generates a snake game from a github user contributions grid and output a screen capture as gif",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"repository": "github:platane/snk",
|
"repository": "github:platane/snk",
|
||||||
|
|||||||
3
packages/action/.gitignore
vendored
3
packages/action/.gitignore
vendored
@@ -1,3 +0,0 @@
|
|||||||
!dist
|
|
||||||
!dist/build
|
|
||||||
out.gif
|
|
||||||
@@ -4,15 +4,14 @@ import { generateContributionSnake } from "./generateContributionSnake";
|
|||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
console.log(core.getInput("user_name"));
|
const userName = core.getInput("github_user_name");
|
||||||
console.log(core.getInput("gif_out_path"));
|
const gifOutPath = core.getInput("gif_out_path");
|
||||||
console.log("--");
|
|
||||||
console.log(process.cwd());
|
|
||||||
console.log("--");
|
|
||||||
console.log(fs.readdirSync(process.cwd()));
|
|
||||||
|
|
||||||
const buffer = await generateContributionSnake(core.getInput("user_name"));
|
const buffer = await generateContributionSnake(userName);
|
||||||
fs.writeFileSync(core.getInput("gif_out_path"), buffer);
|
|
||||||
|
fs.writeFileSync(gifOutPath, buffer);
|
||||||
|
|
||||||
|
console.log(`::set-output name=gif_out_path::${gifOutPath}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
core.setFailed(`Action failed with "${e.message}"`);
|
core.setFailed(`Action failed with "${e.message}"`);
|
||||||
}
|
}
|
||||||
|
|||||||
1
packages/gif-creator/.gitignore
vendored
1
packages/gif-creator/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
out.gif
|
|
||||||
Reference in New Issue
Block a user