👷 push on docker hub

This commit is contained in:
platane
2020-10-15 00:18:02 +02:00
committed by Platane
parent 1e1967ef61
commit 523aebc4d5
5 changed files with 44 additions and 27 deletions

View File

@@ -18,7 +18,6 @@ jobs:
- 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-benchmark: test-benchmark:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -53,11 +52,6 @@ jobs:
ls -l ${{ steps.snake-gif.outputs.gif_out_path }} ls -l ${{ steps.snake-gif.outputs.gif_out_path }}
test -f ${{ steps.snake-gif.outputs.gif_out_path }} test -f ${{ steps.snake-gif.outputs.gif_out_path }}
- uses: actions/upload-artifact@v2
with:
name: output
path: ${{ steps.snake-gif.outputs.gif_out_path }}
- uses: crazy-max/ghaction-github-pages@v2.1.3 - uses: crazy-max/ghaction-github-pages@v2.1.3
with: with:
target_branch: output target_branch: output
@@ -86,3 +80,32 @@ jobs:
build_dir: packages/demo/dist build_dir: packages/demo/dist
env: env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN_GH_PAGES }} GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN_GH_PAGES }}
build-docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.3
- uses: actions/setup-node@v1.4.4
with:
node-version: 14
- uses: bahmutov/npm-install@v1.4.3
- 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
file: packages/action/Dockerfile
context: packages/action

View File

@@ -1,19 +0,0 @@
FROM node:14-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends gifsicle graphicsmagick \
&& rm -rf /var/lib/apt/lists/*
COPY tsconfig.json package.json yarn.lock /github/snk/
COPY packages /github/snk/packages
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"]

View File

@@ -8,7 +8,7 @@ outputs:
runs: runs:
using: "docker" using: "docker"
image: "Dockerfile" image: "platane/snk:latest"
inputs: inputs:
github_user_name: github_user_name:

View File

@@ -0,0 +1,13 @@
FROM node:14-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends gifsicle graphicsmagick \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /github/snk
RUN npm install canvas@2.6.1
COPY dist /github/snk/
CMD ["node", "/github/snk/index.js"]

View File

@@ -10,7 +10,7 @@
"@zeit/ncc": "0.22.3" "@zeit/ncc": "0.22.3"
}, },
"scripts": { "scripts": {
"build": "ncc build ./index.ts --out dist", "build": "ncc build --external canvas --out dist ./index.ts ",
"dev": "ncc run __tests__/dev.ts --quiet | tail -n +2 > out.gif " "dev": "ncc run __tests__/dev.ts --quiet | tail -n +2 > out.gif "
} }
} }