Skip to content

Update README.md

Update README.md #225

Workflow file for this run

name: CI
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm run build
- run: npm run doc
- name: Generate Contributors Images
uses: jaywcjlove/github-action-contributors@main
with:
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
output: website/build/CONTRIBUTORS.svg
avatarSize: 42
# - name: Create Linux App
# working-directory: electron/app
# run: npm run dist-linux
- name: Create Tag
id: create_tag
uses: jaywcjlove/create-tag-action@main
with:
package-path: ./website/package.json
- name: get tag version
id: tag_version
uses: jaywcjlove/changelog-generator@main
- name: Deploy Website
uses: peaceiris/actions-gh-pages@v3
with:
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./website/build
- name: Generate Changelog
id: changelog
uses: jaywcjlove/changelog-generator@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
filter-author: (jaywcjlove|小弟调调™|dependabot\[bot\]|Renovate Bot)
filter: (^[\s]+?[R|r]elease)|(^[R|r]elease)
# Create electron static page
- name: Create electron-compliant static resources.
run: npm run electron
- uses: actions/upload-artifact@v3
with:
name: webiste
path: |
website/build/**
outputs:
version: ${{ steps.changelog.outputs.version }}
create_tag_version: ${{ steps.create_tag.outputs.version }}
create_tag_versionNumber: ${{ steps.create_tag.outputs.versionNumber }}
tag: ${{ steps.changelog.outputs.tag }}
successful: ${{steps.create_tag.outputs.successful }}
gh-pages-short-hash: ${{ steps.changelog.outputs.gh-pages-short-hash }}
docker:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm run build
- run: npm run doc
- run: echo "outputs.version - ${{ needs.build.outputs.version }}"
- run: echo "outputs.create_tag_version - ${{ needs.build.outputs.create_tag_version }}"
- run: echo "outputs.create_tag_versionNumber - ${{ needs.build.outputs.create_tag_versionNumber }}"
- run: echo "outputs.tag - ${{ needs.build.outputs.tag }}"
# Create Docker Image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push image:latest
uses: docker/build-push-action@v3
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ secrets.DOCKER_USER }}/tools:latest
- name: Build and push image:tags
uses: docker/build-push-action@v3
if: needs.build.outputs.successful
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ secrets.DOCKER_USER }}/tools:${{needs.build.outputs.create_tag_versionNumber}}
# Create Docker Image in Github
- name: Login to the GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image:latest
uses: docker/build-push-action@v3
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: ghcr.io/jaywcjlove/tools:latest
- name: Build and push image:tags
uses: docker/build-push-action@v3
if: needs.build.outputs.successful
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: ghcr.io/jaywcjlove/tools:${{needs.build.outputs.create_tag_versionNumber}}
# # Create Docker Image
# - name: Create docker-compliant static resources.
# run: npm run docker
# - name: Docker login
# run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
# - name: Build docs image
# run: docker image build -t tools .
# - name: Tags & Push image(latest)
# run: |
# echo "outputs.tag - ${{ needs.build.outputs.version }}"
# docker tag tools ${{ secrets.DOCKER_USER }}/tools:latest
# docker push ${{ secrets.DOCKER_USER }}/tools:latest
# - name: Tags & Push image(tag)
# if: needs.build.outputs.successful
# run: |
# echo "outputs.tag - ${{ needs.build.outputs.version }}"
# docker tag tools ${{ secrets.DOCKER_USER }}/tools:${{needs.build.outputs.version}}
# docker push ${{ secrets.DOCKER_USER }}/tools:${{needs.build.outputs.version}}
# # Create Docker Image in Github
# - name: Login to GitHub registry
# run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# - name: Build docker image
# run: docker build -t ghcr.io/jaywcjlove/tools:latest .
# - name: Publish to GitHub registry
# run: docker push ghcr.io/jaywcjlove/tools:latest
# - name: Tag docker image (beta) and publish to GitHub registry
# if: needs.build.outputs.successful
# run: |
# echo "version: v${{ needs.build.outputs.version }}"
# docker tag ghcr.io/jaywcjlove/tools:latest ghcr.io/jaywcjlove/tools:${{needs.build.outputs.version}}
# docker push ghcr.io/jaywcjlove/tools:${{needs.build.outputs.version}}
build_windows:
needs: [build]
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install
# run: npm install --build-from-source
run: npm install
- run: npm run hoist
- run: npm run build
# - run: npm run electron
- uses: actions/download-artifact@v3
with:
name: webiste
path: website/build
- name: electron-builder install-app-deps
working-directory: electron/app
run: npm run deps
- run: npm run build:app
- uses: actions/upload-artifact@v3
with:
name: tools-windows
path: |
electron\app\dist\*.exe
build_macos:
needs: [build]
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- run: npm run hoist
- run: npm run build
# - run: npm run electron
- uses: actions/download-artifact@v3
with:
name: webiste
path: website/build
- name: electron-builder install-app-deps
working-directory: electron/app
run: npm run deps
- run: npm run build:app
- uses: actions/upload-artifact@v3
with:
name: tools-macos
path: |
electron/app/dist/*.zip
electron/app/dist/*.dmg
- uses: actions/upload-artifact@v3
with:
name: tools-macos-zip
path: |
electron/app/dist/*.zip
build_linux:
needs: [build]
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- run: npm run hoist
- run: npm run build
# - run: npm run electron
- uses: actions/download-artifact@v3
with:
name: webiste
path: website/build
- name: electron-builder install-app-deps
working-directory: electron/app
run: npm run deps
- run: npm run build:app
- uses: actions/upload-artifact@v3
with:
name: tools-linux
path: |
electron/app/dist/*.deb
electron/app/dist/*.rpm
download:
needs: [build, build_windows, build_macos, build_linux]
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/download-artifact@v3
with:
name: tools-linux
path: dist/linux
- uses: actions/download-artifact@v3
with:
name: tools-macos
path: dist/macos
- uses: actions/download-artifact@v3
with:
name: tools-windows
path: dist/windows
- name: Display structure of downloaded files
working-directory: dist
run: ls -R
create_release:
needs: [build, build_windows, build_macos, build_linux]
if: needs.build.outputs.successful
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/download-artifact@v3
with:
name: tools-linux
path: dist/linux
- uses: actions/download-artifact@v3
with:
name: tools-macos
path: dist/macos
- uses: actions/download-artifact@v3
with:
name: tools-windows
path: dist/windows
- name: Display structure of downloaded files
working-directory: dist
run: ls -R
- name: Generate Changelog
id: changelog
uses: jaywcjlove/changelog-generator@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
filter-author: (jaywcjlove|小弟调调™|dependabot\[bot\]|Renovate Bot)
filter: (^[\s]+?[R|r]elease)|(^[R|r]elease)
- name: Create Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ needs.build.outputs.create_tag_version }}
tag: ${{ needs.build.outputs.create_tag_version }}
artifacts: "dist/linux/*.rpm,dist/linux/*.deb,dist/macos/*.zip,dist/macos/*.dmg,dist/windows/*.exe"
body: |
[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor) [![Docker Image Version (latest by date)](https://img.shields.io/docker/v/wcjiang/tools)](https://hub.docker.com/r/wcjiang/tools) [![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/wcjiang/tools)](https://hub.docker.com/r/wcjiang/tools) [![Docker Pulls](https://img.shields.io/docker/pulls/wcjiang/tools)](https://hub.docker.com/r/wcjiang/tools)
Documentation ${{ needs.build.outputs.create_tag_version }}: https://raw.githack.com/jaywcjlove/tools/${{ needs.build.outputs.gh-pages-short-hash }}/index.html
Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
${{ steps.changelog.outputs.changelog }}
```bash
docker pull wcjiang/tools:${{needs.build.outputs.create_tag_versionNumber}}
```
```bash
docker run --name tools --rm -d -p 9666:3000 wcjiang/tools:${{ needs.build.outputs.create_tag_versionNumber }}
# Or
docker run --name tools -itd -p 9666:3000 wcjiang/tools:${{ needs.build.outputs.create_tag_versionNumber }}
```
Visit the following URL in your browser
```bash
http://localhost:9666/
```
roll_back:
if: failure()
needs: [build, create_release]
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: dev-drprasad/[email protected]
if: needs.build.outputs.successful
with:
delete_release: true
repo: jaywcjlove/tools
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_name: '${{ needs.build.outputs.create_tag_version }}'