Build and Release #146
Workflow file for this run
This file contains hidden or 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 | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., v1.0.0)' | |
| required: true | |
| type: string | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| outputs: | |
| release_id: ${{ steps.create-release.outputs.result }} | |
| tag_name: ${{ steps.create-release.outputs.tag }} | |
| steps: | |
| - name: create release draft | |
| id: create-release | |
| uses: actions/github-script@v7 | |
| env: | |
| MANUAL_TAG: ${{ inputs.version }} | |
| with: | |
| script: | | |
| const manualTag = process.env.MANUAL_TAG ? process.env.MANUAL_TAG.trim() : '' | |
| const inferredTag = context.ref ? context.ref.split('/').pop() : '' | |
| const tag = manualTag || inferredTag | |
| if (!tag) { | |
| core.setFailed('Unable to determine release tag name.') | |
| return | |
| } | |
| const release = await github.rest.repos.createRelease({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| tag_name: tag, | |
| name: `Dashboard for OpenIPC ${tag}`, | |
| body: 'See the assets to download this version and install.', | |
| draft: true, | |
| prerelease: false | |
| }) | |
| core.setOutput('tag', release.data.tag_name) | |
| return release.data.id | |
| build-windows: | |
| runs-on: windows-latest | |
| needs: create-release | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' | |
| cache-dependency-path: 'package-lock.json' | |
| - name: install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: install frontend dependencies | |
| run: npm ci | |
| - name: setup python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| cache: 'pip' | |
| cache-dependency-path: 'requirements.txt' | |
| - name: install Python dependencies | |
| run: python -m pip install -r requirements.txt | |
| - name: cache cargo registry and target | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| src-tauri/target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: download MediaMTX binaries | |
| run: python tools/download-mediamtx.py | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: lint frontend (continue on error) | |
| run: npm run lint | |
| continue-on-error: true | |
| - name: build Tauri app | |
| run: npx tauri build | |
| - name: upload workflow artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-bundles | |
| path: src-tauri/target/release/bundle | |
| - name: attach installer to draft release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| draft: true | |
| tag_name: ${{ needs.create-release.outputs.tag_name }} | |
| files: | | |
| src-tauri/target/release/bundle/**/*.msi |