release v1.3.1 #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release | |
on: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- main | |
jobs: | |
release: | |
runs-on: macos-latest | |
# releaseラベルが付いているPRがマージされたときに実行 | |
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v2 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
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 install | |
- name: Build Application | |
run: yarn build | |
env: | |
GITHUB_APP_CLIENT_ID: ${{ secrets.PROD_GITHUB_APP_CLIENT_ID }} | |
GITHUB_APP_CLIENT_SECRET: ${{ secrets.PROD_GITHUB_APP_CLIENT_SECRET }} | |
# アプリケーションのパッケージング | |
- name: Package app | |
run: yarn package | |
- name: set new version | |
run: | | |
NEW_VERSION=$(node -pe "require('./package.json').version") | |
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV | |
# アップデート後のバージョンのタグを生成してプッシュ | |
- name: push new version tag | |
id: new-version | |
run: | | |
TAG_NAME="v${{ env.NEW_VERSION }}" | |
git tag $TAG_NAME | |
git push origin $TAG_NAME | |
# リリースノートを生成して最新バージョンのアプリケーションを添付 | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
id: release | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: false | |
tag_name: v${{ env.NEW_VERSION }} | |
generate_release_notes: true | |
files: | | |
./packages/main/app/ReviewCat-${{ env.NEW_VERSION }}.dmg | |
# slackに通知 | |
- name: Notify to Slack | |
uses: 8398a7/action-slack@v3 | |
with: | |
fields: repo,job | |
status: ${{ job.status }} | |
mention: channel | |
if_mentions: always | |
text: | | |
v${{ steps.package-version.outputs.current-version }} のリリース🎉 | |
${{ steps.release.outputs.url }} | |
author_name: ${{ github.actor }} | |
icon_emoji: ':octocat:' | |
username: review-cat-bot | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |