From 48359d3d7c3d5253f0fa0111b7d42472e2654846 Mon Sep 17 00:00:00 2001 From: lushi78778 Date: Wed, 27 Dec 2023 23:33:14 +0800 Subject: [PATCH] =?UTF-8?q?workspace=E7=AE=80=E5=8D=95=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=EF=BC=8C=E4=BF=AE=E6=94=B9dist.bat=E8=84=9A?= =?UTF-8?q?=E6=9C=AC,=E6=96=B0=E5=A2=9Edist.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0d9d295 --- /dev/null +++ b/README.md @@ -0,0 +1,140 @@ +# go-tutorial + +这是使用 Writerside 编写文档并自动部署到 GitHub pages 的教程 + +同时也是 Go 语言入门官方教程 + +## Writerside + +Writerside 是一款基于 IntelliJ 平台的 JetBrains IDE。用它来创作、构建、测试和发布技术文档。 + +## 部署方法 + +- 使用 Writerside 创建项目,编写文档,定义实例的相关信息 + +寻找设置 + +![FIND-INSTANCE.png](image/FIND-INSTANCE.png) + +进行编辑 + +![img.png](image/EDIT-INSTANCE.png) + +- 创建自动工作流配置.github/workflows/deploy.yml 文件 + +```Bash +name: Build documentation + +on: + push: + # To trigger the workflow once you push to the `main` branch + # Replace `main` with your branch’s name + branches: ["main"] + # Specify to run a workflow manually from the Actions tab on GitHub + workflow_dispatch: + +permissions: + id-token: write + pages: write + +env: + # Name of module and id separated by a slash + INSTANCE: Writerside/xx + # Replace XX with the ID of the instance in capital letters + ARTIFACT: webHelpXX2-all.zip + # Docker image version + DOCKER_VERSION: 232.10275 + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Build Writerside docs using Docker + uses: JetBrains/writerside-github-action@v4 + with: + instance: ${{ env.INSTANCE }} + artifact: ${{ env.ARTIFACT }} + docker-version: ${{ env.DOCKER_VERSION }} + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: docs + path: | + artifacts/${{ env.ARTIFACT }} + retention-days: 7 + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + # Requires build job results + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: docs + + - name: Unzip artifact + run: unzip -O UTF-8 -qq ${{ env.ARTIFACT }} -d dir + + - name: Setup Pages + uses: actions/configure-pages@v2 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + path: dir + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 +``` + +要修改的部分只有 ``env`` + +```Bash +env: + # 下面xx修改为实例id + INSTANCE: Writerside/xx + # 下面xx修改为构建时产生的文件名称(具体说明看下方图片) + ARTIFACT: webHelpXX2-all.zip + # Docker image version + DOCKER_VERSION: 232.10275 +``` + +![artifact.png](image/artifact.png) + +修改完后应该是 + +```Bash +env: + # Name of module and id separated by a slash + INSTANCE: Writerside/go-tutorial + # Replace XX with the ID of the instance in capital letters + ARTIFACT: webHelpGO-TUTORIAL2-all.zip + # Docker image version + DOCKER_VERSION: 232.10275 +``` + +完整文件请看我的.github/workflows/deploy.yml + +- 创建对应的公开 GitHub rope, 在 GitHub pages 里调整使用 Github Actions 构建 + +详细说明 + +![github-ini.png](image/github-ini.png) + +- 向上推送,享受自动构建的快乐~ + + +## Reference + +https://www.jetbrains.com/help/writerside/deploy-docs-to-github-pages.html \ No newline at end of file