Skip to content

Show the in-progress overlay when deleting a route #30

Show the in-progress overlay when deleting a route

Show the in-progress overlay when deleting a route #30

name: pre_release_debug
on:
workflow_dispatch:
push:
tags:
- prereleases/[0-9]+.[0-9]+.[0-9]+
- prereleases/[0-9]+.[0-9]+.[0-9]+.[0-9]+
permissions:
contents: write
jobs:
create_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get the version
id: get_version
uses: mavrosxristoforos/get-xml-info@1.0
with:
xml-file: './Directory.Build.props'
xpath: '//Version'
- name: Get changelog
id: get_changelog
run: |
./get-changelog.ps1 -currentVersion "${{ steps.get_version.outputs.info }}"
shell: pwsh
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: prerelease/${{ steps.get_version.outputs.info }}
release_name: ${{ steps.get_version.outputs.info }}
draft: false
prerelease: true
body_path: ./version-changelog.md
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.info }}
build_win:
runs-on: windows-2022
needs: create_release
env:
RID: win-x64
steps:
- uses: actions/checkout@v3
- name: Restore dependencies
run: dotnet restore -r ${{ env.RID }}
- name: Use release route repositories
shell: pwsh
run: |
cp src/RoadCaptain.App.Runner/appsettings.routerepositories.release.json src/RoadCaptain.App.Runner/appsettings.routerepositories.json
cp src/RoadCaptain.App.RouteBuilder/appsettings.routerepositories.release.json src/RoadCaptain.App.RouteBuilder/appsettings.routerepositories.json
- name: Test
run: dotnet test --verbosity minimal -c Debug -r ${{ env.RID }} -p:RuntimeIdentifier=${{ env.RID }} -p:RuntimeIdentifiers=${{ env.RID }}
- name: Publish Runner
# Because of reasons we need to explicitly set RuntimeIdentifiers to only win-x64 because MSBuild sets it to osx-x64;win-x64
run: dotnet publish --self-contained -c Debug -r ${{ env.RID }} -p:RuntimeIdentifiers=${{ env.RID }} -p:PreRelease=True src\RoadCaptain.App.Runner\RoadCaptain.App.Runner.csproj
- name: Publish RouteBuilder
run: dotnet publish --self-contained -c Debug -r ${{ env.RID }} -p:RuntimeIdentifiers=${{ env.RID }} -p:PreRelease=True src\RoadCaptain.App.RouteBuilder\RoadCaptain.App.RouteBuilder.csproj
- name: Update Wix components file
run: dotnet run --project .\packaging\RoadCaptain.WixComponentFileGenerator\RoadCaptain.WixComponentFileGenerator.csproj src\RoadCaptain.App.Runner\bin\Debug\net6.0-windows\${{ env.RID }}\publish src\RoadCaptain.App.RouteBuilder\bin\Debug\net6.0-windows\${{ env.RID }}\publish .\packaging\RoadCaptain.Installer\Components.wxi
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Build MSI
# Note: The trailing slash at the end of RunnerTargetDir and RouteBuilderTargetDir is mandatory, otherwise building the MSI fails!
run: msbuild .\packaging\RoadCaptain.Installer\RoadCaptain.Installer.wixproj -property:Configuration=Debug -property:RunnerTargetDir=D:\a\RoadCaptain\RoadCaptain\src\RoadCaptain.App.Runner\bin\Debug\net6.0-windows\${{ env.RID }}\publish\ -property:RouteBuilderTargetDir=D:\a\RoadCaptain\RoadCaptain\src\RoadCaptain.App.RouteBuilder\bin\Debug\net6.0-windows\${{ env.RID }}\publish\ -property:PreRelease=True
- name: Upload Installer
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: D:\a\RoadCaptain\RoadCaptain\packaging\RoadCaptain.Installer\bin\Debug\RoadCaptain_${{ needs.create_release.outputs.version }}.msi
asset_name: RoadCaptain_${{ needs.create_release.outputs.version }}.msi
asset_content_type: application/x-msi
build_macos-x64:
runs-on: macos-11
needs: create_release
env:
TEAM_ID: 44HHP3V8VR
SIGNING_IDENTITY: "Developer ID Application: Codenizer BV (44HHP3V8VR)" # matches Keychain Access certificate name
RID: osx-x64
steps:
- uses: actions/checkout@v3
- name: Use release route repositories
shell: bash
run: |
cp src/RoadCaptain.App.Runner/appsettings.routerepositories.release.json src/RoadCaptain.App.Runner/appsettings.routerepositories.json
cp src/RoadCaptain.App.RouteBuilder/appsettings.routerepositories.release.json src/RoadCaptain.App.RouteBuilder/appsettings.routerepositories.json
- name: Import signing certificate and set up keychain
run: |
# Set up new build keychain
security create-keychain -p "${{ secrets.KEYCHAIN_PASSWORD}}" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD}}" build.keychain
# Decode certificate to file
echo "${{ secrets.MACOS_CERTIFICATE }}" | base64 --decode > certificate.p12
security import certificate.p12 -k build.keychain -P "${{ secrets.MACOS_CERTIFICATE_PWD}}" -T /usr/bin/codesign
# Allow codesign to access keychain
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${{ secrets.KEYCHAIN_PASSWORD}}" build.keychain
# Add app password for notarytool
xcrun notarytool store-credentials "AC_PASSWORD" --apple-id "${{ secrets.APPLE_ID }}" --team-id ${{ env.TEAM_ID }} --password "${{ secrets.NOTARY_TOOL_PASSWORD }}"
- name: Build and package Runner
run: |
PUBLISH_DIR="$RUNNER_TEMP/${{ env.RID }}/Bundles"
VERSION=$(grep Version Directory.Build.props | sed -e 's/<Version>//g' -e 's/<\/Version>//g' | tr -d '\t ')
./packaging/build-macos-app "$PUBLISH_DIR" "$VERSION" "Runner" "${{ env.SIGNING_IDENTITY }}" "${{ env.RID }}" "Debug" "PreRelease"
- name: Build and package RouteBuilder
run: |
PUBLISH_DIR="$RUNNER_TEMP/${{ env.RID }}/Bundles"
VERSION=$(grep Version Directory.Build.props | sed -e 's/<Version>//g' -e 's/<\/Version>//g' | tr -d '\t ')
./packaging/build-macos-app "$PUBLISH_DIR" "$VERSION" "RouteBuilder" "${{ env.SIGNING_IDENTITY }}" "${{ env.RID }}" "Debug" "PreRelease"
- name: Create DMG
run: |
VERSION=`echo ${{ needs.create_release.outputs.version }} | tr -d '\n'`
DISK_IMAGE="$RUNNER_TEMP/RoadCaptain-$VERSION-${{ env.RID }}.dmg"
PUBLISH_DIR="$RUNNER_TEMP/${{ env.RID }}/Bundles"
chmod +x ./packaging/create-dmg
./packaging/create-dmg --volname "RoadCaptain $VERSION" --volicon ./src/RoadCaptain.App.Shared/icon.icns --window-pos 200 120 --window-size 800 533 --icon-size 128 --icon "RoadCaptain RouteBuilder.app" 200 40 --icon "RoadCaptain Runner.app" 200 260 --app-drop-link 600 40 --background "./src/RoadCaptain.App.Shared/Assets/installer-background.jpg" --codesign A357F29F30B7179DCBA515D2A6ECE77620951CBD "$DISK_IMAGE" "$PUBLISH_DIR"
# Notarize disk image
xcrun notarytool submit "$DISK_IMAGE" --keychain-profile "AC_PASSWORD" --wait
xcrun stapler staple "$DISK_IMAGE"
- name: Upload Installer
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: "/Users/runner/work/_temp/RoadCaptain-${{ needs.create_release.outputs.version }}-${{ env.RID }}.dmg" # Explicit path here because $RUNNER_TEMP doesn't get expanded...
asset_name: RoadCaptain-${{ needs.create_release.outputs.version }}-${{ env.RID }}.dmg
asset_content_type: application/x-apple-diskimage
build_macos-arm64:
runs-on: macos-11
needs: create_release
if: ${{ false }} # disable until we resolve the webview packaging issue for arm64
env:
TEAM_ID: 44HHP3V8VR
SIGNING_IDENTITY: "Developer ID Application: Codenizer BV (44HHP3V8VR)" # matches Keychain Access certificate name
RID: osx-arm64
steps:
- uses: actions/checkout@v3
- name: Use release route repositories
shell: bash
run: |
cp src/RoadCaptain.App.Runner/appsettings.routerepositories.release.json src/RoadCaptain.App.Runner/appsettings.routerepositories.json
cp src/RoadCaptain.App.RouteBuilder/appsettings.routerepositories.release.json src/RoadCaptain.App.RouteBuilder/appsettings.routerepositories.json
- name: Import signing certificate and set up keychain
run: |
# Set up new build keychain
security create-keychain -p "${{ secrets.KEYCHAIN_PASSWORD}}" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD}}" build.keychain
# Decode certificate to file
echo "${{ secrets.MACOS_CERTIFICATE }}" | base64 --decode > certificate.p12
security import certificate.p12 -k build.keychain -P "${{ secrets.MACOS_CERTIFICATE_PWD}}" -T /usr/bin/codesign
# Allow codesign to access keychain
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${{ secrets.KEYCHAIN_PASSWORD}}" build.keychain
# Add app password for notarytool
xcrun notarytool store-credentials "AC_PASSWORD" --apple-id "${{ secrets.APPLE_ID }}" --team-id ${{ env.TEAM_ID }} --password "${{ secrets.NOTARY_TOOL_PASSWORD }}"
- name: Build and package Runner
run: |
PUBLISH_DIR="$RUNNER_TEMP/${{ env.RID }}/Bundles"
VERSION=$(grep Version Directory.Build.props | sed -e 's/<Version>//g' -e 's/<\/Version>//g' | tr -d '\t ')
./packaging/build-macos-app "$PUBLISH_DIR" "$VERSION" "Runner" "${{ env.SIGNING_IDENTITY }}" "${{ env.RID }}" "Debug" "PreRelease"
- name: Build and package RouteBuilder
run: |
PUBLISH_DIR="$RUNNER_TEMP/${{ env.RID }}/Bundles"
VERSION=$(grep Version Directory.Build.props | sed -e 's/<Version>//g' -e 's/<\/Version>//g' | tr -d '\t ')
./packaging/build-macos-app "$PUBLISH_DIR" "$VERSION" "RouteBuilder" "${{ env.SIGNING_IDENTITY }}" "${{ env.RID }}" "Debug" "PreRelease"
- name: Create DMG
run: |
VERSION=`echo ${{ needs.create_release.outputs.version }} | tr -d '\n'`
DISK_IMAGE="$RUNNER_TEMP/RoadCaptain-$VERSION-${{ env.RID }}.dmg"
PUBLISH_DIR="$RUNNER_TEMP/${{ env.RID }}/Bundles"
chmod +x ./packaging/create-dmg
./packaging/create-dmg --volname "RoadCaptain $VERSION" --volicon ./src/RoadCaptain.App.Shared/icon.icns --window-pos 200 120 --window-size 800 533 --icon-size 128 --icon "RoadCaptain RouteBuilder.app" 200 40 --icon "RoadCaptain Runner.app" 200 260 --app-drop-link 600 40 --background "./src/RoadCaptain.App.Shared/Assets/installer-background.jpg" --codesign A357F29F30B7179DCBA515D2A6ECE77620951CBD "$DISK_IMAGE" "$PUBLISH_DIR"
# Notarize disk image
xcrun notarytool submit "$DISK_IMAGE" --keychain-profile "AC_PASSWORD" --wait
xcrun stapler staple "$DISK_IMAGE"
- name: Upload Installer
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: "/Users/runner/work/_temp/RoadCaptain-${{ needs.create_release.outputs.version }}-${{ env.RID }}.dmg" # Explicit path here because $RUNNER_TEMP doesn't get expanded...
asset_name: RoadCaptain-${{ needs.create_release.outputs.version }}-${{ env.RID }}.dmg
asset_content_type: application/x-apple-diskimage
update_site_releases:
runs-on: ubuntu-latest
needs: [create_release, build_win, build_macos-x64, build_macos-arm64]
if: ${{ always() && needs.build_win.result == 'success' && needs.build_macos-x64.result == 'success' }}
steps:
- uses: actions/checkout@v3
- name: Replace pre-release version
shell: bash
run: |
previous_version=`sed -nr "s/.*prerelease%2F([0-9]\.[0-9]*\.[0-9]*\.[0-9]*).*$/\1/p" site/data/releases.yml | head -n 1`
sed -i "s/$previous_version/${{needs.create_release.outputs.version}}/g" site/data/releases.yml
git config user.email "roadcaptain@roadcaptain.nl"
git config user.name "Roadcaptain (bot)"
git add site/data/releases.yml
git commit -m "Update pre-release version on website"
git push