|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: windows-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout repository |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Add Loading Message to Release |
| 20 | + shell: bash |
| 21 | + env: |
| 22 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 23 | + run: | |
| 24 | + if gh release view ${{ github.ref_name }} > /dev/null 2>&1; then |
| 25 | + ORIGINAL_BODY=$(gh release view ${{ github.ref_name }} --json body -q .body) |
| 26 | + echo "$ORIGINAL_BODY" > original_body.txt |
| 27 | + echo "⏳ **現在実行ファイル(インストーラーおよびポータブル版)をビルド中です。完了まで1〜2分程度お待ちください...**" > temp_body.txt |
| 28 | + echo "⏳ **Currently building executables (Installer and Portable versions). Please wait 1-2 minutes until they are available...**" >> temp_body.txt |
| 29 | + echo "" >> temp_body.txt |
| 30 | + echo "$ORIGINAL_BODY" >> temp_body.txt |
| 31 | + gh release edit ${{ github.ref_name }} --notes-file temp_body.txt |
| 32 | + else |
| 33 | + echo "" > original_body.txt |
| 34 | + echo "⏳ **現在実行ファイル(インストーラーおよびポータブル版)をビルド中です。完了まで1〜2分程度お待ちください...**" > temp_body.txt |
| 35 | + echo "⏳ **Currently building executables (Installer and Portable versions). Please wait 1-2 minutes until they are available...**" >> temp_body.txt |
| 36 | + gh release create ${{ github.ref_name }} --title "Release ${{ github.ref_name }}" --notes-file temp_body.txt |
| 37 | + fi |
| 38 | +
|
| 39 | + - name: Setup .NET |
| 40 | + uses: actions/setup-dotnet@v4 |
| 41 | + with: |
| 42 | + dotnet-version: '10.0.x' |
| 43 | + |
| 44 | + - name: Publish Portable Build |
| 45 | + run: dotnet publish NoraBar/NoraBar.csproj -c Release -r win-x64 --self-contained false -o out/portable |
| 46 | + |
| 47 | + - name: Create Portable Zip |
| 48 | + run: Compress-Archive -Path out/portable/* -DestinationPath out/NoraBar-Portable-win-x64.zip |
| 49 | + |
| 50 | + - name: Build Installer (Inno Setup) |
| 51 | + uses: Minionguyjpro/Inno-Setup-Action@v1.2.2 |
| 52 | + with: |
| 53 | + path: setup.iss |
| 54 | + |
| 55 | + - name: Release to GitHub |
| 56 | + uses: softprops/action-gh-release@v2 |
| 57 | + with: |
| 58 | + files: | |
| 59 | + out/NoraBar-Portable-win-x64.zip |
| 60 | + Output/NoraBar-Setup.exe |
| 61 | + name: Release ${{ github.ref_name }} |
| 62 | + draft: false |
| 63 | + prerelease: false |
| 64 | + env: |
| 65 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + |
| 67 | + - name: Remove Loading Message |
| 68 | + shell: bash |
| 69 | + env: |
| 70 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + run: | |
| 72 | + if [ -f original_body.txt ]; then |
| 73 | + gh release edit ${{ github.ref_name }} --notes-file original_body.txt |
| 74 | + fi |
0 commit comments