Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
feat: mainにマージした際に成果物をプレリリースする ② (#102)
Browse files Browse the repository at this point in the history
* 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サーバルールの戻し?
  • Loading branch information
book000 authored Nov 5, 2021
1 parent f3f7484 commit cd91768
Showing 1 changed file with 120 additions and 0 deletions.
120 changes: 120 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}`
})

0 comments on commit cd91768

Please sign in to comment.