Skip to content

更新ログワークフロー修正 #20

更新ログワークフロー修正

更新ログワークフロー修正 #20

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
# ビルドとリリースまでの処理
build-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup JDK #JDKセットアップ
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- name: Setup Gradle #Gradleセットアップ
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Gradle Check #Gradle動作確認
shell: bash
run: |
chmod +x gradlew
chmod -R +X gradle
./gradlew check
- name: Generate Changelog #更新ログ生成
shell: bash
run: |
./gradlew patchChangelog
./gradlew getChangelog --console=plain -q --no-header --no-summary --no-links > LATEST_CHANGELOG.md
CHANGELOG_NUM=`grep -n "^###" LATEST_CHANGELOG.md | sed -e 's/:.*//g' | head -n 1`
if [ -n "$CHANGELOG_NUM" ]; then
tail -n +$CHANGELOG_NUM LATEST_CHANGELOG.md > LATEST_CHANGELOG_TMP.md
mv LATEST_CHANGELOG_TMP.md LATEST_CHANGELOG.md
fi
echo "---ChangeLog---"
cat LATEST_CHANGELOG.md
echo "---------------"
- name: Build #ビルド
shell: bash
run: |
./gradlew build publish --stacktrace --no-daemon
env:
mavenpassword: ${{ secrets.MAVEN_PASSWORD }}
- name: Collect Releases #リリースしたものを収集
shell: bash
run: |
mkdir release
cd release
cp -r ../selfhost/build/libs/. ./
- name: Generate Hash #リリースするファイルのハッシュファイルを生成
uses: TeamFelnull/actions-reusable-workflows/.github/actions/hashing-directory@master
with:
directory_path: "${{ github.workspace }}/release"
- name: Upload Artifact #アーティファクトをアップロード
uses: actions/upload-artifact@v3
with:
name: releases
path: release/*
- name: GitHub Releases #GiHubにリリース
uses: softprops/action-gh-release@v1
with:
body_path: LATEST_CHANGELOG.md
files: release/*
# リリース後の処理
post-release:
name: Update after release
needs: build-release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup JDK #JDKセットアップ
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- name: Setup Gradle #Gradleセットアップ
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Gradle Check #Gradle動作確認
shell: bash
run: |
chmod +x gradlew
chmod -R +X gradle
./gradlew check
- name: Generate Changelog #チェンジログ生成してコミット
shell: bash
run: |
./gradlew patchChangelog
git checkout "remotes/origin/master"
git config user.email "[email protected]"
git config user.name "GitHub Action"
git add ./CHANGELOG.md
git commit -m "変更ログを更新(${{ github.ref_name }})"
git push -u origin
echo "Commit done!"