From 7c4393d44a242c4fb186b96839f4097677a5d6e9 Mon Sep 17 00:00:00 2001 From: zhengyi Date: Wed, 6 Dec 2023 23:02:18 +0800 Subject: [PATCH] :green_heart: Add gitea ci --- .gitea/ISSUE_TEMPLATE/bug_report.zh.yml | 50 +++++++++++ .gitea/ISSUE_TEMPLATE/config.yml | 5 ++ .gitea/ISSUE_TEMPLATE/feature_request.zh.yml | 31 +++++++ .gitea/workflows/build.yml | 87 ++++++++++++++++++++ 4 files changed, 173 insertions(+) create mode 100644 .gitea/ISSUE_TEMPLATE/bug_report.zh.yml create mode 100644 .gitea/ISSUE_TEMPLATE/config.yml create mode 100644 .gitea/ISSUE_TEMPLATE/feature_request.zh.yml create mode 100644 .gitea/workflows/build.yml diff --git a/.gitea/ISSUE_TEMPLATE/bug_report.zh.yml b/.gitea/ISSUE_TEMPLATE/bug_report.zh.yml new file mode 100644 index 0000000..8bc9737 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/bug_report.zh.yml @@ -0,0 +1,50 @@ +name: Bug 反馈 +description: 提交 Bug 反馈 +labels: [ bug ] +body: + - type: markdown + id: preface + attributes: + value: | + 感谢你花时间填写此错误报告!在开始之前,我们非常推荐阅读一遍[《开源最佳实践》](https://github.com/LinuxSuRen/open-source-best-practice),这会在很大程度上提高我们彼此的效率。 + - type: markdown + id: environment + attributes: + value: "## 环境信息" + - type: input + id: version + validations: + required: true + attributes: + label: "是什么版本出现了此问题?" + description: "可以在管理后台的关于页面中找到。" + - type: input + id: site-url + attributes: + label: "在线站点地址" + description: "如果可以的话,请提供你的站点地址。这可能会帮助我们更好的定位问题。" + placeholder: "ex. https://halo.run" + validations: + required: false + - type: markdown + id: details + attributes: + value: "## 详细信息" + - type: textarea + id: what-happened + attributes: + label: "发生了什么?" + description: "最好还告诉我们,你预计会发生什么。" + validations: + required: true + - type: textarea + id: logs + attributes: + label: "相关日志输出" + description: "请复制并粘贴任何相关的日志输出。 这将自动格式化为代码,因此无需反引号。" + render: shell + - type: textarea + id: additional-information + attributes: + label: "附加信息" + description: "如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。" diff --git a/.gitea/ISSUE_TEMPLATE/config.yml b/.gitea/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..252e839 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: 对 Joe3 有其他问题 + url: xxxxxx + about: 如果你还有其他疑问,可以加群沟通。 \ No newline at end of file diff --git a/.gitea/ISSUE_TEMPLATE/feature_request.zh.yml b/.gitea/ISSUE_TEMPLATE/feature_request.zh.yml new file mode 100644 index 0000000..9b09587 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/feature_request.zh.yml @@ -0,0 +1,31 @@ +name: 新特性建议 +description: 提交新特性建议 +body: + - type: markdown + id: preface + attributes: + value: "你好!在开始之前,我们非常推荐阅读一遍[《开源最佳实践》](https://github.com/LinuxSuRen/open-source-best-practice),这会在很大程度上提高我们彼此的效率。" + - type: markdown + id: environment + attributes: + value: "## 环境信息" + - type: input + id: version + attributes: + label: "你当前使用的版本" + description: "可以在管理后台的关于页面中找到。" + - type: markdown + id: details + attributes: + value: "## 详细信息" + - type: textarea + id: description + attributes: + label: "描述一下此特性" + validations: + required: true + - type: textarea + id: additional-information + attributes: + label: "附加信息" + description: "如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。" \ No newline at end of file diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..6952c76 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,87 @@ +name: Build distribution theme + +on: + release: + types: + - created + +jobs: + build: + runs-on: debian-12 + steps: + - uses: actions/checkout@v3 + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Compress zip + run: | + PACKAGE_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json) + PRE_ZIP_FOLDER=halo-theme-Joe3-${PACKAGE_VERSION} + ARTIFACT_NAME=${PRE_ZIP_FOLDER}.zip + ARTIFACT_PATHNAME=dist/${ARTIFACT_NAME} + echo "halo-theme-Joe3 version $PACKAGE_VERSION" + echo "Artifact name: ${ARTIFACT_NAME}" + echo "Artifact pathname: ${ARTIFACT_PATHNAME}" + echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV + echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV + echo "ARTIFACT_PATHNAME=${ARTIFACT_PATHNAME}" >> $GITHUB_ENV + echo "RELEASE_ID=${{ github.event.release.id }}" >> $GITHUB_ENV + mkdir $PRE_ZIP_FOLDER + mkdir dist + cp -r theme.yaml settings.yaml annotation-setting.yaml templates $PRE_ZIP_FOLDER/ + zip -r $ARTIFACT_PATHNAME $PRE_ZIP_FOLDER + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: halo-theme-Joe3 + path: | + dist/*.zip + retention-days: 7 + + github-release: + runs-on: debian-12 + if: github.event_name == 'release' + steps: + - uses: actions/checkout@v3 + with: + submodules: false + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Compress zip + run: | + PACKAGE_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' package.json) + PRE_ZIP_FOLDER=halo-theme-Joe3-${PACKAGE_VERSION} + ARTIFACT_NAME=${PRE_ZIP_FOLDER}.zip + ARTIFACT_PATHNAME=dist/${ARTIFACT_NAME} + echo "halo-theme-Joe3 version $PACKAGE_VERSION" + echo "Artifact name: ${ARTIFACT_NAME}" + echo "Artifact pathname: ${ARTIFACT_PATHNAME}" + echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV + echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV + echo "ARTIFACT_PATHNAME=${ARTIFACT_PATHNAME}" >> $GITHUB_ENV + echo "RELEASE_ID=${{ github.event.release.id }}" >> $GITHUB_ENV + mkdir $PRE_ZIP_FOLDER + mkdir dist + cp -r theme.yaml settings.yaml annotation-setting.yaml templates $PRE_ZIP_FOLDER/ + zip -r $ARTIFACT_PATHNAME $PRE_ZIP_FOLDER + - name: Upload a release asset + uses: actions/github-script@v2 + with: + github-token: ${{secrets.TOKEN}} + script: | + const fs = require('fs').promises; + const { repo: { owner, repo }, sha } = context; + console.log({ owner, repo, sha }); + const releaseId = process.env.RELEASE_ID + const artifactPathName = process.env.ARTIFACT_PATHNAME + const artifactName = process.env.ARTIFACT_NAME + console.log('Releasing', releaseId, artifactPathName, artifactName) + await github.repos.uploadReleaseAsset({ + owner, repo, + release_id: releaseId, + name: artifactName, + data: await fs.readFile(artifactPathName) + });