chore: update workflows config.

This commit is contained in:
jaywcjlove 2022-11-09 12:04:25 +08:00
parent b562a8f9cf
commit 7263f1a8bc
1 changed files with 110 additions and 110 deletions

View File

@ -6,141 +6,141 @@ on:
jobs: jobs:
build-deploy: build-deploy:
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 16
- name: Generate Contributors Images - name: Generate Contributors Images
uses: jaywcjlove/github-action-contributors@main uses: jaywcjlove/github-action-contributors@main
with: with:
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\]) filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
avatarSize: 42 avatarSize: 42
- name: Build Linux Command - name: Build Linux Command
run: | run: |
npm install npm install
npm run dash npm run dash
cp CONTRIBUTORS.svg .deploy cp CONTRIBUTORS.svg .deploy
rm -rf .deploy/linux-command.docset rm -rf .deploy/linux-command.docset
- name: Create Tag - name: Create Tag
id: create_tag id: create_tag
uses: jaywcjlove/create-tag-action@v1.3.6 uses: jaywcjlove/create-tag-action@main
with: with:
package-path: ./package.json package-path: ./package.json
- name: Get Tag Version - name: Get Tag Version
id: tag_version id: tag_version
uses: jaywcjlove/changelog-generator@v1.5.3 uses: jaywcjlove/changelog-generator@main
- name: Update Dash Feed - name: Update Dash Feed
run: | run: |
echo "<entry><version>${{steps.create_tag.outputs.versionNumber}}</version><url>https://jaywcjlove.github.io/linux-command/linux-command.docset.tgz</url></entry>" > .deploy/linux-command-docset.xml echo "<entry><version>${{steps.create_tag.outputs.versionNumber}}</version><url>https://jaywcjlove.github.io/linux-command/linux-command.docset.tgz</url></entry>" > .deploy/linux-command-docset.xml
- name: Deploy - name: Deploy
uses: peaceiris/actions-gh-pages@v3 uses: peaceiris/actions-gh-pages@v3
with: with:
commit_message: '[${{steps.tag_version.outputs.tag}}] ${{ github.event.head_commit.message }}' commit_message: '[${{steps.tag_version.outputs.tag}}] ${{ github.event.head_commit.message }}'
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./.deploy publish_dir: ./.deploy
user_name: github-actions[bot] user_name: github-actions[bot]
user_email: github-actions[bot]@users.noreply.github.com user_email: github-actions[bot]@users.noreply.github.com
- name: Generate Changelog - name: Generate Changelog
id: changelog id: changelog
uses: jaywcjlove/changelog-generator@v1.5.3 uses: jaywcjlove/changelog-generator@main
with: with:
filter-author: (小弟调调™) filter-author: (小弟调调™)
filter: (^[\s]+?[R|r]elease)|(^[R|r]elease) filter: (^[\s]+?[R|r]elease)|(^[R|r]elease)
- name: Create Release - name: Create Release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
if: steps.create_tag.outputs.successful if: steps.create_tag.outputs.successful
with: with:
artifacts: '.deploy/linux-command.docset.tgz' artifacts: '.deploy/linux-command.docset.tgz'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.create_tag.outputs.version }} name: ${{ steps.create_tag.outputs.version }}
tag: ${{ steps.create_tag.outputs.version }} tag: ${{ steps.create_tag.outputs.version }}
body: | body: |
[![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/linux-command@${{steps.create_tag.outputs.versionNumber}}/file/README.md) [![npm bundle size](https://img.shields.io/bundlephobia/minzip/linux-command)](https://bundlephobia.com/result?p=linux-command@${{steps.create_tag.outputs.versionNumber}}) [![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/linux-command@${{steps.create_tag.outputs.versionNumber}}/file/README.md) [![npm bundle size](https://img.shields.io/bundlephobia/minzip/linux-command)](https://bundlephobia.com/result?p=linux-command@${{steps.create_tag.outputs.versionNumber}})
```bash ```bash
npm i linux-command@${{steps.create_tag.outputs.versionNumber}} npm i linux-command@${{steps.create_tag.outputs.versionNumber}}
``` ```
${{ steps.changelog.outputs.compareurl }} ${{ steps.changelog.outputs.compareurl }}
${{ steps.changelog.outputs.changelog }} ${{ steps.changelog.outputs.changelog }}
Document linux-command@${{ steps.changelog.outputs.tag }}: Document linux-command@${{ steps.changelog.outputs.tag }}:
https://raw.githack.com/jaywcjlove/linux-command/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html https://raw.githack.com/jaywcjlove/linux-command/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
## Docker ## Docker
[![Docker Image Version (latest by date)](https://img.shields.io/docker/v/wcjiang/linux-command)](https://hub.docker.com/r/wcjiang/linux-command) [![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/wcjiang/linux-command)](https://hub.docker.com/r/wcjiang/linux-command) [![Docker Pulls](https://img.shields.io/docker/pulls/wcjiang/linux-command)](https://hub.docker.com/r/wcjiang/linux-command) [![Docker Image Version (latest by date)](https://img.shields.io/docker/v/wcjiang/linux-command)](https://hub.docker.com/r/wcjiang/linux-command) [![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/wcjiang/linux-command)](https://hub.docker.com/r/wcjiang/linux-command) [![Docker Pulls](https://img.shields.io/docker/pulls/wcjiang/linux-command)](https://hub.docker.com/r/wcjiang/linux-command)
轻松通过 `docker` 部署 `linux-command` 网站。 轻松通过 `docker` 部署 `linux-command` 网站。
```bash ```bash
docker pull wcjiang/linux-command docker pull wcjiang/linux-command
``` ```
```bash ```bash
docker run --name linux-command --rm -d -p 9665:3000 wcjiang/linux-command:latest docker run --name linux-command --rm -d -p 9665:3000 wcjiang/linux-command:latest
# Or # Or
docker run --name linux-command -itd -p 9665:3000 wcjiang/linux-command:latest docker run --name linux-command -itd -p 9665:3000 wcjiang/linux-command:latest
``` ```
在浏览器中访问以下 URL 在浏览器中访问以下 URL
```bash ```bash
http://localhost:9665/ http://localhost:9665/
``` ```
- name: Push Npm - name: Push Npm
run: | run: |
npm install @jsdevtools/npm-publish -g npm install @jsdevtools/npm-publish -g
npm-publish --token="${{ secrets.NPM_TOKEN }}" ./package.json npm-publish --token="${{ secrets.NPM_TOKEN }}" ./package.json
# Create Docker Image # Create Docker Image
- name: Docker login - name: Docker login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Build linux-command image - name: Build linux-command image
run: | run: |
rm -rf .deploy/linux-command.docset.tgz rm -rf .deploy/linux-command.docset.tgz
docker image build -t linux-command . docker image build -t linux-command .
- name: Tags & Push image(latest) - name: Tags & Push image(latest)
run: | run: |
docker tag linux-command ${{ secrets.DOCKER_USER }}/linux-command:latest docker tag linux-command ${{ secrets.DOCKER_USER }}/linux-command:latest
docker push ${{ secrets.DOCKER_USER }}/linux-command:latest docker push ${{ secrets.DOCKER_USER }}/linux-command:latest
- name: Tags & Push image - name: Tags & Push image
if: steps.create_tag.outputs.successful if: steps.create_tag.outputs.successful
run: | run: |
echo "outputs.tag - ${{ steps.changelog.outputs.version }}" echo "outputs.tag - ${{ steps.changelog.outputs.version }}"
docker tag linux-command ${{ secrets.DOCKER_USER }}/linux-command:${{steps.changelog.outputs.version}} docker tag linux-command ${{ secrets.DOCKER_USER }}/linux-command:${{steps.changelog.outputs.version}}
docker push ${{ secrets.DOCKER_USER }}/linux-command:${{steps.changelog.outputs.version}} docker push ${{ secrets.DOCKER_USER }}/linux-command:${{steps.changelog.outputs.version}}
# Create Docker Image in Github # Create Docker Image in Github
- name: Login to GitHub registry - name: Login to GitHub registry
run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build docker image - name: Build docker image
run: docker build -t ghcr.io/jaywcjlove/linux-command:latest . run: docker build -t ghcr.io/jaywcjlove/linux-command:latest .
- name: Publish to GitHub registry - name: Publish to GitHub registry
run: docker push ghcr.io/jaywcjlove/linux-command:latest run: docker push ghcr.io/jaywcjlove/linux-command:latest
- name: Tag docker image (beta) and publish to GitHub registry - name: Tag docker image (beta) and publish to GitHub registry
if: steps.create_tag.outputs.successful if: steps.create_tag.outputs.successful
run: | run: |
echo "version: v${{ steps.changelog.outputs.version }}" echo "version: v${{ steps.changelog.outputs.version }}"
docker tag ghcr.io/jaywcjlove/linux-command:latest ghcr.io/jaywcjlove/linux-command:${{steps.changelog.outputs.version}} docker tag ghcr.io/jaywcjlove/linux-command:latest ghcr.io/jaywcjlove/linux-command:${{steps.changelog.outputs.version}}
docker push ghcr.io/jaywcjlove/linux-command:${{steps.changelog.outputs.version}} docker push ghcr.io/jaywcjlove/linux-command:${{steps.changelog.outputs.version}}