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

Commit

Permalink
fix: deploy merged to release
Browse files Browse the repository at this point in the history
  • Loading branch information
book000 committed Jan 16, 2022
1 parent df3dc0e commit 32a7e6c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 56 deletions.
55 changes: 0 additions & 55 deletions .github/workflows/deploy.yml

This file was deleted.

49 changes: 48 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,51 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
body: `# リリースが完了しました\n\n${{ steps.create_release.outputs.html_url }}`
})
})
deploy:
runs-on: ubuntu-latest
needs: release
if: github.event.pull_request.merged == true

steps:
- name: Deploy
id: deployRequest
uses: fjogeleit/http-request-action@master
with:
url: ${{ secrets.DEPLOY_URL }}
method: 'POST'
bearerToken: ${{ secrets.DEPLOY_KEY }}
ignoreStatusCodes: '500'
timeout: 600000

- name: Show Response
run: echo ${{ steps.deployRequest.outputs.response }}

- name: Is Successful Deploy
if: ${{ fromJson(steps.deployRequest.outputs.response).status == 'SUCCESSFUL' }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
# :white_check_mark: デプロイが完了しました
プルリクエストがマージされたため、本番環境へのデプロイを行いました。
バージョンは `${{ fromJson(steps.deployRequest.outputs.response).version }}` です。稼働中バージョンの確認は Minecraft サーバ内で `/ver MyMaid4` を実行することで確認できます。
反映は本番環境の再起動後ですので、アクティブログインユーザーの同意を得て再起動するか、3時の自動再起動を待ってください。
- name: Is Failed Deploy
if: ${{ fromJson(steps.deployRequest.outputs.response).status == 'ERROR' }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
# :x: デプロイに失敗しました
プルリクエストがマージされたため、本番環境へのデプロイを行おうとしましたが失敗しました。
エラー内容は以下の通りです。
```
${{ fromJson(steps.deployRequest.outputs.response).type }} (${{ fromJson(steps.deployRequest.outputs.response).type_ja }}) - ${{ fromJson(steps.deployRequest.outputs.response).status }} (${{ fromJson(steps.deployRequest.outputs.response).status_ja }})
${{ fromJson(steps.deployRequest.outputs.response).message }}
```

0 comments on commit 32a7e6c

Please sign in to comment.