mirror of
https://github.com/ivuorinen/hiha-arvio.git
synced 2026-01-26 11:24:04 +00:00
refactor: modernize publish workflow to use softprops/action-gh-release
- Replace deprecated actions/create-release@v1 with softprops/action-gh-release@v2.4.2 - Replace deprecated actions/upload-release-asset@v1 with artifact pattern - Eliminates set-output deprecation warnings - Uses modern GitHub Actions artifact upload/download pattern - All actions pinned to commit SHAs for security - Simpler workflow structure with clearer separation of concerns
This commit is contained in:
240
.github/workflows/publish.yml
vendored
240
.github/workflows/publish.yml
vendored
@@ -15,12 +15,119 @@ env:
|
||||
DOTNET_VERSION: '8.0.x'
|
||||
|
||||
jobs:
|
||||
build-ios:
|
||||
name: Build iOS
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
|
||||
|
||||
- name: Get version
|
||||
id: get_version
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Restore workloads
|
||||
run: dotnet workload restore src/HihaArvio/HihaArvio.csproj
|
||||
|
||||
- name: Build iOS Release
|
||||
run: |
|
||||
dotnet publish src/HihaArvio/HihaArvio.csproj \
|
||||
-f net8.0-ios \
|
||||
-c Release \
|
||||
/p:ApplicationDisplayVersion=${{ steps.get_version.outputs.version }} \
|
||||
/p:ApplicationVersion=${{ github.run_number }} \
|
||||
/p:ArchiveOnBuild=false \
|
||||
/p:EnableCodeSigning=false
|
||||
|
||||
- name: Create iOS artifact archive
|
||||
run: |
|
||||
cd src/HihaArvio/bin/Release/net8.0-ios
|
||||
# Find the .app bundle (it's in a subdirectory like iossimulator-arm64 or ios-arm64)
|
||||
APP_PATH=$(find . -name "*.app" -type d | head -n 1)
|
||||
if [ -z "$APP_PATH" ]; then
|
||||
echo "Error: No .app bundle found"
|
||||
exit 1
|
||||
fi
|
||||
zip -r HihaArvio-iOS-${{ steps.get_version.outputs.version }}.zip "$APP_PATH"
|
||||
mv HihaArvio-iOS-${{ steps.get_version.outputs.version }}.zip ${{ github.workspace }}/
|
||||
|
||||
- name: Upload iOS artifact
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||
with:
|
||||
name: ios-release
|
||||
path: HihaArvio-iOS-${{ steps.get_version.outputs.version }}.zip
|
||||
retention-days: 7
|
||||
|
||||
build-maccatalyst:
|
||||
name: Build macOS
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
|
||||
|
||||
- name: Get version
|
||||
id: get_version
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Restore workloads
|
||||
run: dotnet workload restore src/HihaArvio/HihaArvio.csproj
|
||||
|
||||
- name: Build macOS Catalyst Release
|
||||
run: |
|
||||
dotnet publish src/HihaArvio/HihaArvio.csproj \
|
||||
-f net8.0-maccatalyst \
|
||||
-c Release \
|
||||
/p:ApplicationDisplayVersion=${{ steps.get_version.outputs.version }} \
|
||||
/p:ApplicationVersion=${{ github.run_number }} \
|
||||
/p:ArchiveOnBuild=false \
|
||||
/p:EnableCodeSigning=false
|
||||
|
||||
- name: Create macOS artifact archive
|
||||
run: |
|
||||
cd src/HihaArvio/bin/Release/net8.0-maccatalyst
|
||||
# Find the .app bundle (it's in a subdirectory like maccatalyst-x64 or maccatalyst-arm64)
|
||||
APP_PATH=$(find . -name "*.app" -type d | head -n 1)
|
||||
if [ -z "$APP_PATH" ]; then
|
||||
echo "Error: No .app bundle found"
|
||||
exit 1
|
||||
fi
|
||||
zip -r HihaArvio-macOS-${{ steps.get_version.outputs.version }}.zip "$APP_PATH"
|
||||
mv HihaArvio-macOS-${{ steps.get_version.outputs.version }}.zip ${{ github.workspace }}/
|
||||
|
||||
- name: Upload macOS artifact
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
|
||||
with:
|
||||
name: maccatalyst-release
|
||||
path: HihaArvio-macOS-${{ steps.get_version.outputs.version }}.zip
|
||||
retention-days: 7
|
||||
|
||||
create-release:
|
||||
name: Create Release
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
version: ${{ steps.get_version.outputs.version }}
|
||||
needs: [build-ios, build-maccatalyst]
|
||||
if: always() && needs.build-ios.result == 'success' && needs.build-maccatalyst.result == 'success'
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@@ -55,14 +162,21 @@ jobs:
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Download iOS artifact
|
||||
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
|
||||
with:
|
||||
tag_name: ${{ github.event_name == 'workflow_dispatch' && format('v{0}', github.event.inputs.version) || github.ref }}
|
||||
release_name: Release ${{ steps.get_version.outputs.version }}
|
||||
name: ios-release
|
||||
|
||||
- name: Download macOS artifact
|
||||
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
|
||||
with:
|
||||
name: maccatalyst-release
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2.4.2
|
||||
with:
|
||||
tag_name: ${{ github.event_name == 'workflow_dispatch' && format('v{0}', github.event.inputs.version) || github.ref_name }}
|
||||
name: Release ${{ steps.get_version.outputs.version }}
|
||||
body: |
|
||||
## HihaArvio v${{ steps.get_version.outputs.version }}
|
||||
|
||||
@@ -76,104 +190,21 @@ jobs:
|
||||
- macOS 12.0+ (via Mac Catalyst)
|
||||
|
||||
### Installation
|
||||
- **iOS**: Download the `.ipa` file and install via Xcode or TestFlight
|
||||
- **macOS**: Download the `.app` bundle and move to Applications folder
|
||||
- **iOS**: Download the `.zip` file, extract, and install via Xcode or TestFlight
|
||||
- **macOS**: Download the `.zip` file, extract, and move to Applications folder
|
||||
|
||||
---
|
||||
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
||||
draft: false
|
||||
prerelease: ${{ contains(steps.get_version.outputs.version, 'alpha') || contains(steps.get_version.outputs.version, 'beta') || contains(steps.get_version.outputs.version, 'rc') }}
|
||||
|
||||
build-and-publish-ios:
|
||||
name: Build and Publish iOS
|
||||
runs-on: macos-latest
|
||||
needs: create-release
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Restore workloads
|
||||
run: dotnet workload restore src/HihaArvio/HihaArvio.csproj
|
||||
|
||||
- name: Build iOS Release
|
||||
run: |
|
||||
dotnet publish src/HihaArvio/HihaArvio.csproj \
|
||||
-f net8.0-ios \
|
||||
-c Release \
|
||||
/p:ApplicationDisplayVersion=${{ needs.create-release.outputs.version }} \
|
||||
/p:ApplicationVersion=${{ github.run_number }} \
|
||||
/p:ArchiveOnBuild=false \
|
||||
/p:EnableCodeSigning=false
|
||||
|
||||
- name: Create iOS artifact archive
|
||||
run: |
|
||||
cd src/HihaArvio/bin/Release/net8.0-ios
|
||||
zip -r HihaArvio-iOS-${{ needs.create-release.outputs.version }}.zip *.app
|
||||
mv HihaArvio-iOS-${{ needs.create-release.outputs.version }}.zip ${{ github.workspace }}/
|
||||
|
||||
- name: Upload iOS Release Asset
|
||||
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||
asset_path: ./HihaArvio-iOS-${{ needs.create-release.outputs.version }}.zip
|
||||
asset_name: HihaArvio-iOS-${{ needs.create-release.outputs.version }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
build-and-publish-maccatalyst:
|
||||
name: Build and Publish macOS
|
||||
runs-on: macos-latest
|
||||
needs: create-release
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
|
||||
with:
|
||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||
|
||||
- name: Restore workloads
|
||||
run: dotnet workload restore src/HihaArvio/HihaArvio.csproj
|
||||
|
||||
- name: Build macOS Catalyst Release
|
||||
run: |
|
||||
dotnet publish src/HihaArvio/HihaArvio.csproj \
|
||||
-f net8.0-maccatalyst \
|
||||
-c Release \
|
||||
/p:ApplicationDisplayVersion=${{ needs.create-release.outputs.version }} \
|
||||
/p:ApplicationVersion=${{ github.run_number }} \
|
||||
/p:ArchiveOnBuild=false \
|
||||
/p:EnableCodeSigning=false
|
||||
|
||||
- name: Create macOS artifact archive
|
||||
run: |
|
||||
cd src/HihaArvio/bin/Release/net8.0-maccatalyst
|
||||
zip -r HihaArvio-macOS-${{ needs.create-release.outputs.version }}.zip *.app
|
||||
mv HihaArvio-macOS-${{ needs.create-release.outputs.version }}.zip ${{ github.workspace }}/
|
||||
|
||||
- name: Upload macOS Release Asset
|
||||
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||
asset_path: ./HihaArvio-macOS-${{ needs.create-release.outputs.version }}.zip
|
||||
asset_name: HihaArvio-macOS-${{ needs.create-release.outputs.version }}.zip
|
||||
asset_content_type: application/zip
|
||||
files: |
|
||||
HihaArvio-iOS-${{ steps.get_version.outputs.version }}.zip
|
||||
HihaArvio-macOS-${{ steps.get_version.outputs.version }}.zip
|
||||
|
||||
publish-status:
|
||||
name: Publish Status
|
||||
runs-on: ubuntu-latest
|
||||
needs: [create-release, build-and-publish-ios, build-and-publish-maccatalyst]
|
||||
needs: [build-ios, build-maccatalyst, create-release]
|
||||
if: always()
|
||||
|
||||
steps:
|
||||
@@ -181,18 +212,17 @@ jobs:
|
||||
run: |
|
||||
echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "Version: ${{ needs.create-release.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "### Build Status" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- iOS: ${{ needs.build-and-publish-ios.result }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- macOS Catalyst: ${{ needs.build-and-publish-maccatalyst.result }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- iOS: ${{ needs.build-ios.result }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- macOS Catalyst: ${{ needs.build-maccatalyst.result }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Release: ${{ needs.create-release.result }}" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
if [[ "${{ needs.build-and-publish-ios.result }}" == "success" ]] && [[ "${{ needs.build-and-publish-maccatalyst.result }}" == "success" ]]; then
|
||||
if [[ "${{ needs.build-ios.result }}" == "success" ]] && [[ "${{ needs.build-maccatalyst.result }}" == "success" ]] && [[ "${{ needs.create-release.result }}" == "success" ]]; then
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "✅ All builds succeeded and artifacts published" >> $GITHUB_STEP_SUMMARY
|
||||
exit 0
|
||||
else
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "❌ One or more builds failed" >> $GITHUB_STEP_SUMMARY
|
||||
echo "❌ One or more steps failed" >> $GITHUB_STEP_SUMMARY
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user