Snapshot 41f668a90254a68a85603ff736dfb8436cc32492 #120
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: 'Release' | |
run-name: "${{ github.event_name == 'release' && format('Release {0}', github.ref_name) || format('Snapshot {0}', github.sha) }}" | |
on: | |
release: | |
types: [ published ] | |
workflow_dispatch: | |
env: | |
TAURI_BUILD_FLAGS: "${{ github.event_name == 'release' && ' ' || '-d' }}" | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: webosbrew | |
SENTRY_PROJECT: dev-manager-desktop-ui | |
SENTRY_ENVIRONMENT: "${{ github.event_name == 'release' && 'release' || 'development' }}" | |
jobs: | |
sentry-create-release: | |
name: Create Sentry Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Extract Version | |
id: pkg-version | |
uses: Saionaro/extract-package-version@v1.2.1 | |
- name: Generate Sentry Release Name | |
id: release-info | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
if (process.env.SENTRY_ENVIRONMENT !== 'release') { | |
return "${{ steps.pkg-version.outputs.version }}-" + context.sha.substring(0, 7); | |
} else { | |
return "${{ steps.pkg-version.outputs.version }}"; | |
} | |
result-encoding: string | |
- uses: getsentry/action-release@v1 | |
name: Create Sentry Release | |
with: | |
version: ${{ steps.release-info.outputs.result }} | |
ignore_missing: true | |
ignore_empty: true | |
finalize: false | |
outputs: | |
release: ${{ steps.release-info.outputs.result }} | |
build: | |
name: Build Package | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: windows | |
os: windows-latest | |
- target: linux-x86_64 | |
os: ubuntu-22.04 | |
- target: linux-arm64 | |
os: debian-arm64-latest | |
- target: macos | |
os: macos-latest | |
- target: android | |
os: ubuntu-22.04 | |
runs-on: ${{ matrix.os }} | |
needs: sentry-create-release | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Node Modules | |
uses: actions/cache@v4 | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: "${{ matrix.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}" | |
restore-keys: | | |
${{ matrix.os }}-node_modules | |
- name: Install Required Packages (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential curl wget file libssl-dev libayatana-appindicator3-dev \ | |
libwebkit2gtk-4.1-dev librsvg2-dev | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Write Version | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const release = "${{ needs.sentry-create-release.outputs.release }}".trim(); | |
if (!release) { | |
core.setFailed('Sentry release was not found'); | |
return; | |
} | |
const fs = require('fs'); | |
fs.writeFileSync('src/release.json', JSON.stringify({ | |
version: release | |
})); | |
- name: Install NPM Dependencies | |
run: npm ci | |
- name: Build the app (Windows) | |
if: startsWith(matrix.target, 'windows') | |
run: | | |
rustup target add i686-pc-windows-msvc | |
npm run build -- --features=vendored-openssl --target x86_64-pc-windows-msvc ${{ env.TAURI_BUILD_FLAGS }} | |
npm run build -- --features=vendored-openssl --target i686-pc-windows-msvc ${{ env.TAURI_BUILD_FLAGS }} | |
- name: Build the app (Linux) | |
if: startsWith(matrix.target, 'linux') | |
run: npm run build -- --features=vendored-openssl ${{ env.TAURI_BUILD_FLAGS }} | |
- name: Build the app (macOS) | |
if: startsWith(matrix.target, 'macos') | |
run: | | |
# Blocked by https://github.com/webosbrew/dev-manager-desktop/issues/116 | |
# rustup target add aarch64-apple-darwin | |
# npm run build -- --features=vendored-openssl --target universal-apple-darwin ${{ env.TAURI_BUILD_FLAGS }} | |
npm run build -- --features=vendored-openssl ${{ env.TAURI_BUILD_FLAGS }} | |
- name: Build the app (Android) | |
if: startsWith(matrix.target, 'android') | |
shell: bash | |
run: | | |
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android | |
npm run tauri android init | |
npm run tauri android build -- --aab | |
- name: Upload Source Maps | |
run: npx --yes @sentry/cli sourcemaps upload -r ${{ needs.sentry-create-release.outputs.release }} dist | |
- name: Upload Android Bundle | |
uses: actions/upload-artifact@v4 | |
if: startsWith(matrix.target, 'android') | |
with: | |
name: android-bundle | |
path: | | |
src-tauri/gen/android/app/build/outputs/bundle/universalRelease/*.aab | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
if: ${{ !startsWith(matrix.target, 'android') && github.event_name != 'release' }} | |
with: | |
name: ${{ matrix.target }}-snapshot | |
path: | | |
target/**/bundle/deb/*.deb | |
target/**/bundle/appimage/*.AppImage | |
target/**/bundle/msi/*.msi | |
target/**/bundle/dmg/*.dmg | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
if: ${{ !startsWith(matrix.target, 'android') && github.event_name == 'release' }} | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: Dev Manager ${{ github.ref_name }} | |
allowUpdates: true | |
omitNameDuringUpdate: true | |
omitBodyDuringUpdate: true | |
omitPrereleaseDuringUpdate: true | |
artifacts: "target/**/bundle/deb/*.deb,\ | |
target/**/bundle/appimage/*.AppImage,\ | |
target/**/bundle/msi/*.msi,\ | |
target/**/bundle/dmg/*.dmg" | |
sentry-finalize-release: | |
name: Finalize Sentry Release | |
runs-on: ubuntu-latest | |
needs: [ sentry-create-release, build ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: getsentry/action-release@v1 | |
with: | |
version: ${{ needs.sentry-create-release.outputs.release }} | |
ignore_missing: true | |
ignore_empty: true | |
finalize: false |