Merge branch 'feat/web-app-testing' of https://github.com/sparrowapp-β¦ #78
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: feat/web-app-testing | |
on: | |
push: | |
branches: | |
- feat/web-app-testing | |
workflow_dispatch: | |
env: | |
VITE_API_URL: ${{ secrets.VITE_API_URL_DEV }} | |
VITE_MIX_PANEL_TOKEN: ${{ secrets.VITE_MIX_PANEL_TOKEN }} | |
VITE_ENABLE_MIX_PANEL: ${{ secrets.VITE_ENABLE_MIX_PANEL_DEV }} | |
VITE_API_TIMEOUT: ${{ secrets.VITE_API_TIMEOUT }} | |
VITE_SPARROW_SUPPORT_EMAIL: ${{ secrets.VITE_SPARROW_SUPPORT_EMAIL }} | |
VITE_AUTH_URL: ${{ secrets.VITE_AUTH_URL_DEV }} | |
VITE_SPARROW_GITHUB: ${{ secrets.VITE_SPARROW_GITHUB }} | |
VITE_SPARROW_DOWNLOAD_LINK: ${{ secrets.VITE_SPARROW_DOWNLOAD_LINK }} | |
VITE_RELEASE_NOTES_PAT_TOKEN: ${{ secrets.VITE_RELEASE_NOTES_PAT_TOKEN }} | |
VITE_RELEASE_NOTES_API: ${{ vars.VITE_RELEASE_NOTES_API }} | |
VITE_AZURE_CDN_URL: ${{ vars.VITE_AZURE_CDN_URL }} | |
VITE_AZURE_INSIGHTS_CONNECTION_STRING: ${{ vars.VITE_AZURE_INSIGHTS_CONNECTION_STRING }} | |
VITE_CANNY_API: ${{ vars.VITE_CANNY_API }} | |
VITE_CANNY_URL: ${{ vars.VITE_CANNY_URL }} | |
VITE_BASE_URL: ${{ vars.VITE_BASE_URL }} | |
VITE_SPARROW_LINKEDIN: ${{ vars.VITE_SPARROW_LINKEDIN }} | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
jobs: | |
release_win: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20.x' | |
- name: Install Windows SDK | |
run: Invoke-WebRequest -Uri https://aka.ms/winsdk/10/latest/SdkSetup.exe -OutFile $env:TEMP\SdkSetup.exe | |
shell: powershell | |
- name: Set up .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 3.1 | |
- name: Install Rust 1.76.0 | |
run: | | |
Invoke-WebRequest -Uri https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe -OutFile rustup-init.exe | |
.\rustup-init.exe -y | |
rustup install 1.76.0 | |
rustup default 1.76.0 | |
- name: Update updater endpoint in tauri.conf.json file | |
run: | | |
$content = Get-Content apps/@sparrow-desktop/src-tauri/tauri.conf.json -Raw | |
$newContent = $content -replace '"https://{{UPDATER_URL}}/updater/{{target}}/{{arch}}/{{current_version}}"', '"https://${{ secrets.UPDATER_ENDPOINT_DEV }}/updater/{{target}}/{{arch}}/{{current_version}}"' | |
Set-Content -Path apps/@sparrow-desktop/src-tauri/tauri.conf.json -Value $newContent | |
shell: pwsh | |
- name: Build Tauri App | |
run: | | |
yarn cache clean | |
npm install -g pnpm | |
yarn install | |
yarn desktop-build | |
# yarn tauri build --debug | |
env: | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
GITHUB_TOKEN: ${{ secrets.PR_GITHUB_TOKEN }} | |
- name: msi sig | |
run: Get-Content D:\a\sparrow-app\sparrow-app\apps\@sparrow-desktop\src-tauri\target\release\bundle\msi\*.sig | |
- name: nsis sig | |
run: Get-Content D:\a\sparrow-app\sparrow-app\apps\@sparrow-desktop\src-tauri\target\release\bundle\nsis\*.sig | |
- name: sign msi | |
run: | | |
$cert = New-SelfSignedCertificate -Subject "CN=Certificate" -CertStoreLocation "Cert:\LocalMachine\My" -KeyUsage DigitalSignature -Type CodeSigningCert -KeySpec Signature -NotAfter (Get-Date).AddDays(90) | |
$certPath = "Cert:\LocalMachine\My\$($cert.Thumbprint)" | |
$password = ConvertTo-SecureString -String "sparrow123" -Force -AsPlainText | |
Export-PfxCertificate -Cert $certPath -FilePath "D:\a\sparrow-app\sparrow-app\apps\@sparrow-desktop\src-tauri\target\release\bundle\Certificate.pfx" -Password $password | |
& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\SignTool.exe" sign /f "D:\a\sparrow-app\sparrow-app\apps\@sparrow-desktop\src-tauri\target\release\bundle\Certificate.pfx" /p sparrow123 /tr http://timestamp.digicert.com /td sha256 /fd sha256 /v "D:\a\sparrow-app\sparrow-app\apps\@sparrow-desktop\src-tauri\target\release\bundle\msi\*.msi" | |
- name: Install AWS CLI | |
uses: chrislennon/action-aws-cli@v1.1 | |
with: | |
version: latest | |
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Upload files to S3 | |
run: | | |
aws s3 sync D:\a\sparrow-app\sparrow-app\apps\@sparrow-desktop\src-tauri\target\release\bundle\msi s3://sparrow-release-assests-dev --exclude "*" --include "*.zip" --include "*.msi" | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
release_macos: | |
runs-on: macos-latest | |
needs: release_win | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Install Rust 1.76.0 | |
run: | | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
rustup install 1.76.0 | |
rustup default 1.76.0 | |
- name: Sync node version and setup cache | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.8' | |
- name: Update updater endpoint in tauri.conf.json file | |
run: | | |
content=$(<apps/@sparrow-desktop/src-tauri/tauri.conf.json) | |
newContent=$(echo "$content" | sed 's|"https://{{UPDATER_URL}}/updater/{{target}}/{{arch}}/{{current_version}}"|"https://${{ secrets.UPDATER_ENDPOINT_DEV }}/updater/{{target}}/{{arch}}/{{current_version}}"|g') | |
echo "$newContent" > apps/@sparrow-desktop/src-tauri/tauri.conf.json | |
shell: bash | |
- name: Build Tauri App | |
run: | | |
yarn install | |
yarn tauri build --debug | |
env: | |
APPLE_SIGNING_IDENTITY: "${{ secrets.APPLE_SIGNING_IDENTITY }}" | |
APPLE_CERTIFICATE: "${{ secrets.APPLE_CERTIFICATE }}" | |
APPLE_CERTIFICATE_PASSWORD: "${{ secrets.APPLE_CERTIFICATE_PASSWORD }}" | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
GITHUB_TOKEN: ${{ secrets.PR_GITHUB_TOKEN }} | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
- name: file content | |
run: cat /Users/runner/work/sparrow-app/sparrow-app/apps/@sparrow-desktop/src-tauri/target/debug/bundle/macos/*.sig | |
- name: Install AWS CLI | |
run: | | |
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" | |
sudo installer -pkg AWSCLIV2.pkg -target / | |
aws --version | |
- name: Upload & downlode File to S3 | |
run: | | |
aws s3 cp /Users/runner/work/sparrow-app/sparrow-app/apps/@sparrow-desktop/src-tauri/target/debug/bundle/macos s3://sparrow-release-assests-dev --recursive --exclude "*" --include "*.gz" | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Download MSI files from S3 bucket | |
run: | | |
mkdir msi_files | |
aws s3 cp s3://sparrow-release-assests-dev/ msi_files/ --recursive --exclude "*" --include "*.msi" | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Install App Center CLI | |
run: | | |
npm install -g appcenter-cli@latest | |
- name: Get PR Branch Name | |
id: pr_branch | |
run: echo "::set-output name=branch::$(echo ${{ github.head_ref }})" | |
- name: Upload to App Center | |
run: | | |
appcenter login --token ${{ secrets.APPCENTER_API_TOKEN }} | |
branch_name="${{ steps.pr_branch.outputs.branch }}" | |
echo "Branch Name: $branch_name" | |
appcenter distribute release -f /Users/runner/work/sparrow-app/sparrow-app/apps/@sparrow-desktop/src-tauri/target/debug/bundle/dmg/*.dmg -g Collaborators --app techdome/Sparrow-1 --build-version test-${branch_name} --build-number ${{ github.run_number }} | |
appcenter distribute release -f msi_files/*.msi -g Collaborators --app techdome/Sparrow --build-version test-${branch_name} --build-number ${{ github.run_number }} | |
- name: status check and upload | |
uses: neonidian/teams-notify-build-status@v3 | |
if: always() | |
with: | |
webhookUrl: | | |
${{ secrets.TEAMS_INCOMING_WEBHOOK_URL }} | |
message: | | |
π **Build Status Update** π | |
The workflow (sparrow-app for **Mac**) has completed with status: **${{ job.status }}**. | |
π Check it out latest release here for feat/sparrow-refactoring branch [AppCenter](https://appcenter.ms/users/techdome/apps/Sparrow-mac)! | |
titleBackgroundColor: ${{ job.status }} | |
env: | |
SHOULD_DISPLAY_VIEW_COMMIT_BUTTON: true | |
- name: status check and upload | |
uses: neonidian/teams-notify-build-status@v3 | |
if: always() | |
with: | |
webhookUrl: | | |
${{ secrets.TEAMS_INCOMING_WEBHOOK_URL }} | |
message: | | |
π **Build Status Update** π | |
The workflow (sparrow-app for windows) has completed with status: **${{ job.status }}**. | |
π Check it out latest release here for feat/sparrow-refactoring branch [AppCenter](https://appcenter.ms/users/techdome/apps/Sparrow)! | |
titleBackgroundColor: ${{ job.status }} | |
env: | |
SHOULD_DISPLAY_VIEW_COMMIT_BUTTON: true |