Skip to content

Commit

Permalink
chore(ci): test build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
LeafdTK committed Feb 5, 2025
1 parent 0c8dcf3 commit 8831c11
Show file tree
Hide file tree
Showing 4 changed files with 339 additions and 6 deletions.
255 changes: 255 additions & 0 deletions .github/workflows/test-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
name: Release
'on':
push:
branches:
- test
concurrency:
group: '${{ github.workflow }}'
cancel-in-progress: false
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
platform:
- macos-latest
- windows-latest
- ubuntu-22.04
runs-on: '${{ matrix.platform }}'
steps:
- uses: actions/checkout@v4
- name: Rust setup (mac)
if: 'startsWith(matrix.platform, ''macos'')'
uses: dtolnay/rust-toolchain@stable
with:
components: 'rustfmt, clippy'
targets: 'aarch64-apple-darwin, x86_64-apple-darwin'
- name: Rust setup
if: '!startsWith(matrix.platform, ''macos'')'
uses: dtolnay/rust-toolchain@stable
with:
components: 'rustfmt, clippy'
- name: Setup rust cache
uses: actions/cache@v4
with:
path: |
target/**
!target/*/release/bundle/*/*.dmg
!target/*/release/bundle/*/*.app.tar.gz
!target/*/release/bundle/*/*.app.tar.gz.sig
!target/release/bundle/*/*.dmg
!target/release/bundle/*/*.app.tar.gz
!target/release/bundle/*/*.app.tar.gz.sig
!target/release/bundle/appimage/*.AppImage
!target/release/bundle/appimage/*.AppImage.tar.gz
!target/release/bundle/appimage/*.AppImage.tar.gz.sig
!target/release/bundle/deb/*.deb
!target/release/bundle/rpm/*.rpm
!target/release/bundle/msi/*.msi
!target/release/bundle/msi/*.msi.zip
!target/release/bundle/msi/*.msi.zip.sig
!target/release/bundle/nsis/*.exe
!target/release/bundle/nsis/*.nsis.zip
!target/release/bundle/nsis/*.nsis.zip.sig
key: '${{ runner.os }}-rust-target-${{ hashFiles(''**/Cargo.lock'') }}'
restore-keys: |
${{ runner.os }}-rust-target-
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm via corepack
shell: bash
run: |
corepack enable
corepack prepare --activate
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: '${{ steps.pnpm-cache.outputs.STORE_PATH }}'
key: '${{ runner.os }}-pnpm-store-${{ hashFiles(''**/pnpm-lock.yaml'') }}'
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: install dependencies (ubuntu only)
if: 'startsWith(matrix.platform, ''ubuntu'')'
run: >
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl
wget file libxdo-dev libssl-dev pkg-config
libayatana-appindicator3-dev librsvg2-dev
- name: Install frontend dependencies
run: pnpm install
- name: build app (macos)
run: >-
pnpm --filter=@modrinth/app run tauri build --target
universal-apple-darwin --config "tauri-release.conf.json"
if: 'startsWith(matrix.platform, ''macos'')'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
ENABLE_CODE_SIGNING: '${{ secrets.CSC_LINK }}'
APPLE_CERTIFICATE: '${{ secrets.CSC_LINK }}'
APPLE_CERTIFICATE_PASSWORD: '${{ secrets.CSC_KEY_PASSWORD }}'
APPLE_SIGNING_IDENTITY: '${{ secrets.APPLE_SIGNING_IDENTITY }}'
APPLE_ID: '${{ secrets.APPLE_ID }}'
APPLE_TEAM_ID: '${{ secrets.APPLE_TEAM_ID }}'
APPLE_PASSWORD: '${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}'
TAURI_SIGNING_PRIVATE_KEY: '${{ secrets.TAURI_PRIVATE_KEY }}'
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: '${{ secrets.TAURI_KEY_PASSWORD }}'

- name: build app
run: >-
pnpm --filter=@modrinth/app run tauri build --config
"tauri-release.conf.json"
id: build_os
if: '!startsWith(matrix.platform, ''macos'')'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
TAURI_SIGNING_PRIVATE_KEY: '${{ secrets.TAURI_PRIVATE_KEY }}'
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: '${{ secrets.TAURI_KEY_PASSWORD }}'

- name: Sign files with Trusted Signing
if: startsWith(matrix.platform, 'windows')
uses: azure/trusted-signing-action@v0.5.1
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
endpoint: https://weu.codesigning.azure.net/
trusted-signing-account-name: marcusklauncher
certificate-profile-name: MarcuskStudioLauncher
files-folder: ${{ github.workspace }}\target\release\bundle
files-folder-filter: msi,exe
files-folder-recurse: true
file-digest: SHA256
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256

- name: 'upload ${{ matrix.platform }}'
uses: actions/upload-artifact@v4
with:
name: '${{ matrix.platform }}'
path: |
target/*/release/bundle/*/*.dmg
target/*/release/bundle/*/*.app.tar.gz
target/*/release/bundle/*/*.app.tar.gz.sig
target/release/bundle/*/*.dmg
target/release/bundle/*/*.app.tar.gz
target/release/bundle/*/*.app.tar.gz.sig
target/release/bundle/*/*.AppImage
target/release/bundle/*/*.AppImage.tar.gz
target/release/bundle/*/*.AppImage.tar.gz.sig
target/release/bundle/*/*.deb
target/release/bundle/*/*.rpm
target/release/bundle/msi/*.msi
target/release/bundle/msi/*.msi.zip
target/release/bundle/msi/*.msi.zip.sig
target/release/bundle/nsis/*.exe
target/release/bundle/nsis/*.nsis.zip
target/release/bundle/nsis/*.nsis.zip.sig
upload-s3:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Print directory structure
run: ls -R artifacts

- name: Extract version from Windows binary
id: extract_version
run: |
exe_path=$(find artifacts/windows-latest/release/bundle/nsis -name "MARCUSK Launcher_*_x64-setup.exe" | head -1)
filename=$(basename "$exe_path")
version=$(echo "$filename" | sed -E 's/MARCUSK Launcher_([0-9]+\.[0-9]+\.[0-9]+)_x64-setup.exe/\1/')
echo "version=$version" >> $GITHUB_OUTPUT
- name: Generate update manifest
id: generate_manifest
env:
DOWNLOAD_URL_BASE: 'https://cdn.marcuskstudio.live'
VERSION: ${{ steps.extract_version.outputs.version }}
run: |
cat > update-manifest.json << EOF
{
"version": "${VERSION}",
"notes": "A new version of the MARCUSK Launcher is out!.",
"pub_date": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
"platforms": {
"darwin-x86_64": {
"signature": "$(cat artifacts/macos-latest/universal-apple-darwin/release/bundle/macos/*.app.tar.gz.sig)",
"url": "https://cdn.marcuskstudio.live/releases/${VERSION}/macos-latest/universal-apple-darwin/release/bundle/macos/MARCUSKLauncher.app.tar.gz",
"install_urls": [
"https://cdn.marcuskstudio.live/releases/${VERSION}/macos-latest/universal-apple-darwin/release/bundle/dmg/MARCUSKLauncher_0.9.2_universal.dmg"
]
},
"darwin-aarch64": {
"signature": "$(cat artifacts/macos-latest/universal-apple-darwin/release/bundle/macos/*.app.tar.gz.sig)",
"url": "https://cdn.marcuskstudio.live/releases/${VERSION}/macos-latest/universal-apple-darwin/release/bundle/macos/MARCUSKLauncher.app.tar.gz",
"install_urls": [
"https://cdn.marcuskstudio.live/releases/${VERSION}/macos-latest/universal-apple-darwin/release/bundle/macos/MARCUSKLauncher.app.tar.gz"
]
},
"linux-x86_64": {
"signature": "$(cat artifacts/ubuntu-22.04/release/bundle/appimage/*.AppImage.tar.gz.sig)",
"url": "https://cdn.marcuskstudio.live/releases/${VERSION}/ubuntu-22.04/release/bundle/appimage/MARCUSKLauncher_${VERSION}_amd64.AppImage.tar.gz",
"install_urls": [
"https://cdn.marcuskstudio.live/releases/${VERSION}/ubuntu-22.04/release/bundle/deb/MARCUSKLauncher_${VERSION}_amd64.deb",
"https://cdn.marcuskstudio.live/releases/${VERSION}/ubuntu-22.04/release/bundle/appimage/MARCUSKLauncher_${VERSION}_amd64.AppImage",
"https://cdn.marcuskstudio.live/releases/${VERSION}/ubuntu-22.04/release/bundle/rpm/MARCUSKLauncher-${VERSION}-1.x86_64.rpm"
]
},
"windows-x86_64": {
"signature": "$(cat artifacts/windows-latest/release/bundle/nsis/MARCUSKLauncher_${VERSION}_x64-setup.nsis.zip.sig)",
"url": "https://cdn.marcuskstudio.live/releases/${VERSION}/windows-latest/release/bundle/nsis/MARCUSK%20Launcher_${VERSION}_x64-setup.nsis.zip",
"install_urls": [
"https://cdn.marcuskstudio.live/releases/${VERSION}/windows-latest/release/bundle/nsis/MARCUSK%20Launcher_${VERSION}_x64-setup.exe"
]
}
}
}
EOF
- name: Upload artifacts to R2
uses: ryand56/r2-upload-action@latest
with:
r2-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
r2-bucket: launcherbinaries
destination-dir: releases/${{ steps.extract_version.outputs.version }}
source-dir: artifacts
keep-file-fresh: true

- name: Upload update manifest to R2
uses: ryand56/r2-upload-action@latest
with:
r2-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
r2-bucket: launcherbinaries
source-dir: update-manifest.json
destination-dir: ./
keep-file-fresh: true
79 changes: 79 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Test Upload Only
'on':
push:
branches:
- test1
permissions:
contents: read
actions: read # ← Required for cross-workflow artifact access
id-token: write

jobs:
upload-s3:
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
run-id: 13146835720

- name: Extract version from Windows binary
id: extract_version
run: |
exe_path=$(find artifacts/windows-latest/nsis -name "MARCUSK Launcher_*_x64-setup.exe" | head -1)
filename=$(basename "$exe_path")
version=$(echo "$filename" | sed -E 's/MARCUSK Launcher_([0-9]+\.[0-9]+\.[0-9]+)_x64-setup.exe/\1/')
echo "version=$version" >> $GITHUB_OUTPUT
- name: Generate update manifest
id: generate_manifest
env:
DOWNLOAD_URL_BASE: 'https://cdn.marcuskstudio.live'
VERSION: ${{ steps.extract_version.outputs.version }}
run: |
cat > update-manifest.json << EOF
{
"version": "${VERSION}",
"notes": "See the assets to download this version and install.",
"pub_date": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
"platforms": {
"darwin-x86_64": {
signature": "$(cat artifacts/macos-latest/*/*.app.tar.gz.sig)",
"url": "${DOWNLOAD_URL_BASE}/releases/latest/$(basename artifacts/macos-latest/*/*.app.tar.gz)"
},
"darwin-aarch64": {
"signature": "$(cat artifacts/macos-latest/*/*.app.tar.gz.sig)",
"url": "${DOWNLOAD_URL_BASE}/releases/latest/$(basename artifacts/macos-latest/*/*.app.tar.gz)"
},
"linux-x86_64": {
"signature": "$(cat artifacts/ubuntu-22.04/*/*.AppImage.tar.gz.sig)",
"url": "${DOWNLOAD_URL_BASE}/releases/latest/$(basename artifacts/ubuntu-22.04/*/*.AppImage.tar.gz)"
},
"windows-x86_64": {
"signature": "$(cat artifacts/windows-latest/msi/*.msi.zip.sig)",
url": "${DOWNLOAD_URL_BASE}/releases/latest/$(basename artifacts/windows-latest/msi/*.msi.zip)"
}
}
}
EOF
- name: Upload artifacts to R2
uses: randomairborne/r2-release@v1.0.1
with:
r2-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
r2-bucket: launcherbinaries
r2-path: releases/latest
local-path: artifacts

- name: Upload update manifest to R2
uses: randomairborne/r2-release@v1.0.1
with:
r2-account-id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
r2-bucket: launcherbinaries
local-path: update-manifest.json
r2-path: update-manifest.json
4 changes: 2 additions & 2 deletions apps/app/tauri-release.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"plugins": {
"updater": {
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDIwMzM5QkE0M0FCOERBMzkKUldRNTJyZzZwSnN6SUdPRGdZREtUUGxMblZqeG9OVHYxRUlRTzJBc2U3MUNJaDMvZDQ1UytZZmYK",
"endpoints": ["https://launcher-files.modrinth.com/updates.json"]
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDNBRTgyNUUwMUQ4N0U1MEIKUldRTDVZY2Q0Q1hvT2szNnVIWDVqNHVPR2VzODljTnRBZ0tRcCtrZFpjam1CUFRMYng1Yk5YalUK",
"endpoints": ["https://cdn.marcuskstudio.live/update-manifest.json"]
}
}
}
7 changes: 3 additions & 4 deletions apps/app/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": "http://timestamp.digicert.com",
"nsis": {
"installMode": "perMachine",
"installerHooks": "./nsis/hooks.nsi"
Expand Down Expand Up @@ -43,9 +42,9 @@
}
]
},
"productName": "MARCUSK Launcher",
"productName": "MARCUSKLauncher",
"version": "0.9.2",
"mainBinaryName": "Modrinth App",
"mainBinaryName": "MARCUSKLauncher",
"identifier": "MARCUSKLauncher",
"plugins": {
"deep-link": {
Expand Down Expand Up @@ -82,7 +81,7 @@
"capabilities": ["ads", "core", "plugins"],
"csp": {
"default-src": "'self' customprotocol: asset:",
"connect-src": "ipc: http://ipc.localhost https://modrinth.com https://*.modrinth.com https://*.posthog.com https://*.sentry.io https://api.mclo.gs",
"connect-src": "ipc: http://ipc.localhost https://modrinth.com https://*.modrinth.com https://*.posthog.com https://*.sentry.io https://api.mclo.gs https://cdn.marcuskstudio.live https://cdn.marcusk.fun",
"font-src": ["https://cdn-raw.modrinth.com/fonts/inter/"],
"img-src": "https: 'unsafe-inline' 'self' asset: http://asset.localhost blob: data:",
"style-src": "'unsafe-inline' 'self'",
Expand Down

0 comments on commit 8831c11

Please # to comment.