This commit is contained in:
platane
2022-03-24 10:56:07 +01:00
committed by Platane
parent b7298f7ff7
commit c97378f175
8 changed files with 150 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

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

@@ -0,0 +1,73 @@
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 }}