From cd9176839c9cd64f434dbe96db7e4913db818101 Mon Sep 17 00:00:00 2001 From: Tomachi Date: Fri, 5 Nov 2021 17:19:37 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20main=E3=81=AB=E3=83=9E=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=81=97=E3=81=9F=E9=9A=9B=E3=81=AB=E6=88=90=E6=9E=9C?= =?UTF-8?q?=E7=89=A9=E3=82=92=E3=83=97=E3=83=AC=E3=83=AA=E3=83=AA=E3=83=BC?= =?UTF-8?q?=E3=82=B9=E3=81=99=E3=82=8B=20=E2=91=A1=20(#102)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: #88 自動切断後、再接続した場合の処理について追加 * feat: Release action * fix: node 14... * chore: debug ls * fix: プルリク駆動に変更 + test -f -> test -d * chore: test * fix: if の条件修正 * fix: types closed * fix: create zip -> tgz * fix: tar option * fix: リリース情報修正 * feat: releaseにプルリクのbodyを入れる * fix: リリース前調整 * fix: Discordサーバルールの戻し? --- .github/workflows/release.yml | 120 ++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..b3d06567 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,120 @@ +name: Release + +on: + pull_request_target: + branches: + - main + types: + - closed + +jobs: + release: + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true + + steps: + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + + - name: Clone jaoafa/jaoweb + uses: actions/checkout@v2 + with: + repository: jaoafa/jaoweb + + - name: Remove content + run: rm -rf content + + - name: Clone jaoafa/jaoweb-docs + uses: actions/checkout@v2 + with: + path: content + ref: ${{ github.event.pull_request.head.sha }} + + - name: Download authors.json & categories.json + run: | + wget -O content/blog/authors.json https://raw.githubusercontent.com/jaoafa/jaoweb/master/content/blog/authors.json + wget -O content/blog/categories.json https://raw.githubusercontent.com/jaoafa/jaoweb/master/content/blog/categories.json + + - uses: actions/setup-node@v2 + with: + node-version: 14 + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Cache node_modules + uses: actions/cache@v2 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install dependencies + run: yarn + + - name: Nuxt build + run: yarn cross-env NUXT_TELEMETRY_DISABLED=1 nuxt build + + - name: Nuxt generate + run: yarn cross-env NUXT_TELEMETRY_DISABLED=1 nuxt generate + + - name: Check exists dist + run: | + ls -la + test -d dist + + - name: Set jaoweb SHORT_SHA + id: jaoweb-vars + run: | + echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)" + + - name: Set jaoweb-docs SHORT_SHA + id: docs-vars + working-directory: ./content + run: echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)" + + - name: Create dist.tgz + run: tar -C dist -cvf dist.tgz . + + - name: Create a Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.docs-vars.outputs.SHORT_SHA }} + release_name: Release ${{ steps.date.outputs.date }} (${{ steps.docs-vars.outputs.SHORT_SHA }}) + draft: false + prerelease: true + body: | + ```markdown + ${{ github.event.pull_request.body }} + ``` + + jaoweb sha: [${{ steps.jaoweb-vars.outputs.SHORT_SHA }}](https://github.com/jaoafa/jaoweb/commit/${{ steps.jaoweb-vars.outputs.SHORT_SHA }}) + jaoweb-docs sha: ${{ steps.docs-vars.outputs.SHORT_SHA }} + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist.tgz + asset_name: dist.tgz + asset_content_type: application/zip + + - name: Released comment + uses: actions/github-script@v4 + with: + script: | + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `# リリースが完了しました\n\n${{ steps.create_release.outputs.html_url }}` + })