diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 780747869538..000000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,215 +0,0 @@ -name: CI -on: - push: - branches: - - main - -jobs: - build: - if: github.repository == 'jaywcjlove/reference' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - - run: npm install - - run: npm run build - - - name: Generate Contributors Images - uses: jaywcjlove/github-action-contributors@main - id: contributors - with: - filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\]) - output: dist/CONTRIBUTORS.svg - avatarSize: 42 - - - name: Modify CONTRIBUTING.md - uses: jaywcjlove/github-action-modify-file-content@main - with: - path: CONTRIBUTING.md - body: | - ${{steps.contributors.outputs.htmlList}} - - - name: Modify README.md - uses: jaywcjlove/github-action-modify-file-content@main - with: - path: README.md - body: | - ${{steps.contributors.outputs.htmlList}} - - - name: Create Tag - id: create_tag - uses: jaywcjlove/create-tag-action@main - with: - package-path: ./package.json - - - name: gh-pages README.md - working-directory: dist - run: | - cat << "EOF" > README.md - Website: https://jaywcjlove.github.io/reference - ## Docker - - [![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/reference)](https://hub.docker.com/r/wcjiang/reference) [![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/wcjiang/reference)](https://hub.docker.com/r/wcjiang/reference) [![Docker Pulls](https://img.shields.io/docker/pulls/wcjiang/reference)](https://hub.docker.com/r/wcjiang/reference) - - 轻松通过 `docker` 部署 `Quick Reference` 网站。 - - ```bash - docker pull wcjiang/reference - ``` - - ```bash - docker run --name reference --rm -d -p 9667:3000 wcjiang/reference:latest - # Or - docker run --name reference -itd -p 9667:3000 wcjiang/reference:latest - ``` - - 在浏览器中访问以下 URL - - ```bash - http://localhost:9667/ - ``` - EOF - - - name: Deploy - uses: peaceiris/actions-gh-pages@v4 - with: - commit_message: ${{ github.event.head_commit.message }} - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist - - - name: Generate Changelog - id: changelog - uses: jaywcjlove/changelog-generator@main - with: - filter-author: (小弟调调™|\@github-actions-bot\@renovate-bot|dependabot|renovate\\[bot\\]|dependabot\\[bot\\]|Renovate Bot) - filter: (^[\s]+?[R|r]elease)|(^[R|r]elease) - - - name: Create Release - uses: jaywcjlove/create-tag-action@main - if: steps.create_tag.outputs.successful - with: - package-path: ./package.json - version: ${{steps.create_tag.outputs.version}} - release: true - prerelease: false - draft: false - body: | - [![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor) - - Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/jaywcjlove/reference/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html - Comparing Changes: ${{ steps.changelog.outputs.compareurl }} - - ${{ steps.changelog.outputs.changelog }} - - ## Docker - [![Docker Image Version (latest by date)](https://img.shields.io/docker/v/wcjiang/reference)](https://hub.docker.com/r/wcjiang/reference) [![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/wcjiang/reference)](https://hub.docker.com/r/wcjiang/reference) [![Docker Pulls](https://img.shields.io/docker/pulls/wcjiang/reference)](https://hub.docker.com/r/wcjiang/reference) - - 轻松通过 `docker` 部署 `Quick Reference` 网站。 - - ```bash - docker pull wcjiang/reference - ``` - - ```bash - docker run --name reference --rm -d -p 9667:3000 wcjiang/reference:latest - # Or - docker run --name reference -itd -p 9667:3000 wcjiang/reference:latest - ``` - - 在浏览器中访问以下 URL - - ```bash - http://localhost:9667/ - ``` - - # Create Docker Image - - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - run: docker buildx prune - - - name: Build and push image:latest - uses: docker/build-push-action@v5 - with: - push: true - context: . - platforms: linux/amd64,linux/arm64 - tags: wcjiang/reference:latest - - - name: Build and push image:tags - uses: docker/build-push-action@v5 - if: steps.create_tag.outputs.successful - with: - push: true - context: . - platforms: linux/amd64,linux/arm64 - tags: wcjiang/reference:${{steps.changelog.outputs.version}} - - # # 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/reference:latest - - # - name: Build and push image:tags - # uses: docker/build-push-action@v3 - # if: steps.create_tag.outputs.successful - # with: - # push: true - # context: . - # platforms: linux/amd64,linux/arm64 - # tags: ghcr.io/jaywcjlove/reference:${{steps.changelog.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/reference:latest . - - # - name: Publish to GitHub registry - # run: docker push ghcr.io/jaywcjlove/reference:latest - - # - name: Tag docker image (beta) and publish to GitHub registry - # if: steps.create_tag.outputs.successful - # run: | - # echo "version: v${{ steps.changelog.outputs.version }}" - # docker tag ghcr.io/jaywcjlove/reference:latest ghcr.io/jaywcjlove/reference:${{steps.changelog.outputs.version}} - # docker push ghcr.io/jaywcjlove/reference:${{steps.changelog.outputs.version}} - - # # Create Docker Image - # - name: Docker login - # run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} - - # - name: Build reference image - # run: docker image build -t reference . - - # - name: Tags & Push image(latest) - # run: | - # echo "DOCKER_USER: ${{ secrets.DOCKER_USER }}" - # docker tag reference ${{ secrets.DOCKER_USER }}/reference:latest - # docker push ${{ secrets.DOCKER_USER }}/reference:latest - - # - name: Tags & Push image - # if: steps.create_tag.outputs.successful - # run: | - # echo "outputs.tag - ${{ steps.changelog.outputs.version }}" - # docker tag reference ${{ secrets.DOCKER_USER }}/reference:${{steps.changelog.outputs.version}} - # docker push ${{ secrets.DOCKER_USER }}/reference:${{steps.changelog.outputs.version}} diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 000000000000..b400e36b988d --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,46 @@ +name: Node.js Package + +# 触发工作流程的事件 +on: + push: + branches: + - main + - "releases/**" + - dev + +# 按顺序运行作业 +jobs: + publish-gpr: + # 指定的运行器环境 + runs-on: ubuntu-latest + # 设置 node 版本 + strategy: + matrix: + node-version: [20] + steps: + # 拉取 github 仓库代码 + - uses: actions/checkout@v3 + # 设定 node 环境 + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + # 设置发包 npm 地址仓库 + registry-url: https://registry.npmjs.org + # 安装依赖,相当于 npm ci + - name: Install dependencies 📦️ + run: npm install + # 执行构建步骤 + - name: 构建 + run: | + npm run build + # 执行部署 + - name: 部署 + # 这个 action 会根据配置自动推送代码到指定分支 + uses: JamesIves/github-pages-deploy-action@releases/v3 + with: + # 指定密钥,即在第一步中设置的 + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + # 指定推送到的远程分支 + BRANCH: pages + # 指定构建之后的产物要推送哪个目录的代码 + FOLDER: build \ No newline at end of file diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml deleted file mode 100644 index c0b865f6fdaf..000000000000 --- a/.github/workflows/win.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Win CI -on: - push: - branches: - - main - -jobs: - build: - if: github.repository == 'jaywcjlove/reference' - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - - run: npm install - - run: npm run build - - run: | - cd ${{ github.workspace }} - ls - cd dist - ls - - - uses: actions/upload-artifact@v4 - with: - name: dist - path: ${{ github.workspace }}\dist\**\* diff --git a/.refsrc.json b/.refsrc.json index d93eb770acf9..e48583883a0d 100644 --- a/.refsrc.json +++ b/.refsrc.json @@ -10,5 +10,5 @@ "github": { "url": "https://github.com/zhanghuid/reference" }, - "license": "© 2024 huid." + "license": "© 2024 huid." } diff --git a/package.json b/package.json index bb149390799d..4c9352e39b00 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@huid/reference", "version": "0.0.1", - "description": "为开发人员分享快速参考备忘单(主要是方便自己)。", + "description": "个人的参考备忘单(主要是方便自己)。", "author": "zhanghuid", "license": "MIT", "homepage": "https://zhanghuid.github.io/reference",