-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add publish workflow template #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ca3e490
feat: add publish workflow template
WSH032 a170de4
feat: use oldest runner and add arm64 builds
WSH032 9f74aad
fix: remove quotes for `--config` argument
WSH032 35638bb
docs: changelog
WSH032 ccfd946
fix: use `--target foo` instead of `--target=bar` for `tauri-action`
WSH032 2f62ba1
Merge remote-tracking branch 'origin/main' into feat/publish-workflow…
WSH032 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
163 changes: 163 additions & 0 deletions
163
templates/{{ '.' }}/{{ project_name }}/.github/workflows/publish.yaml.jinja
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| # See: | ||
| # - <https://github.com/tauri-apps/tauri-action> | ||
| # - <https://pytauri.github.io/pytauri/latest/usage/tutorial/build-standalone/> | ||
|
|
||
| name: "publish" | ||
|
|
||
| on: | ||
| # Manual trigger | ||
| workflow_dispatch: | ||
| # On push to `release` branch | ||
| push: | ||
| branches: | ||
| - release | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| publish-tauri: | ||
| permissions: | ||
| contents: write # required for creating github releases | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - platform: "macos-14" # for Intel based macs. | ||
| target: "x86_64-apple-darwin" | ||
| - platform: "macos-14" # for Arm based macs (M1 and above). | ||
| target: "aarch64-apple-darwin" | ||
| - platform: "ubuntu-22.04" | ||
| target: "x86_64-unknown-linux-gnu" | ||
| - platform: "ubuntu-22.04-arm" | ||
| target: "aarch64-unknown-linux-gnu" | ||
| - platform: "windows-2022" | ||
| target: "x86_64-pc-windows-msvc" | ||
| - platform: "windows-11-arm" | ||
| target: "aarch64-pc-windows-msvc" | ||
|
|
||
| runs-on: {% raw %}${{ matrix.platform }}{% endraw %} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install system dependencies (ubuntu only) | ||
| if: runner.os == 'Linux' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | ||
|
|
||
| - name: Install Rust stable | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: {% raw %}${{ matrix.target }}{% endraw %} | ||
| - name: Rust cache | ||
| uses: swatinem/rust-cache@v2 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v6 | ||
| with: | ||
| enable-cache: true | ||
| # version-file: "pyproject.toml" | ||
|
|
||
| - name: Install pnpm | ||
ISOR3X marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| # Optional: when there is a `packageManager` field in the `package.json` | ||
| version: "latest" | ||
| - name: Install Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| # Or: `node-version-file: package.json` | ||
| node-version: lts/* | ||
| cache: "pnpm" | ||
|
|
||
| - name: Install project dependencies | ||
| run: | | ||
| pnpm install | ||
|
|
||
| # See: | ||
| # - <https://github.com/astral-sh/python-build-standalone/releases> | ||
| # - <https://raw.githubusercontent.com/astral-sh/python-build-standalone/latest-release/latest-release.json> | ||
| # - <https://gregoryszorc.com/docs/python-build-standalone/main/running.html#obtaining-distributions> | ||
| - name: Download python-build-standalone | ||
| env: | ||
| PYTHON_VERSION: "3.13.7" # update this by yourself | ||
| TAG: "20250828" # update this by yourself | ||
| TARGET: {% raw %}${{ matrix.target }}{% endraw %} | ||
| {% raw -%} | ||
| run: | | ||
| url="https://github.com/astral-sh/python-build-standalone/releases/download/${TAG}/cpython-${PYTHON_VERSION}+${TAG}-${TARGET}-install_only_stripped.tar.gz" | ||
| DEST_DIR="src-tauri/pyembed" | ||
|
|
||
| mkdir "$DEST_DIR" | ||
| curl -L "$url" | tar -xz -C "$DEST_DIR" | ||
|
|
||
| # ref: <https://github.com/pytauri/pytauri/issues/99#issuecomment-2704556726> | ||
| if [[ "${{ runner.os }}" == "macOS" ]]; then | ||
| python_major_minor="${PYTHON_VERSION%.*}" # "3.13.7" -> "3.13" | ||
| install_name_tool -id "@rpath/libpython${python_major_minor}.dylib" "$DEST_DIR/python/lib/libpython${python_major_minor}.dylib" | ||
| fi | ||
| {%- endraw %} | ||
|
|
||
| - name: Install the project into the embedded python environment | ||
| env: | ||
| PYTAURI_STANDALONE: 1 # see your `setup.py` | ||
| PYTHON_PATH: {% raw %}${{ runner.os == 'Windows' && './src-tauri/pyembed/python/python.exe' || './src-tauri/pyembed/python/bin/python3' }}{% endraw %} | ||
| {% raw -%} | ||
| run: | | ||
| uv pip install \ | ||
| --exact \ | ||
| --compile-bytecode \ | ||
| --python=${{ env.PYTHON_PATH }} \ | ||
| ./src-tauri | ||
| {%- endraw %} | ||
|
|
||
| # Set build environment variables, see: | ||
| # <https://pytauri.github.io/pytauri/latest/usage/tutorial/build-standalone/#build-and-bundle> | ||
|
|
||
| - name: Set build environment variables (windows) | ||
| if: runner.os == 'Windows' | ||
| shell: pwsh | ||
| run: | | ||
| $PYO3_PYTHON = (Resolve-Path -LiteralPath ".\src-tauri\pyembed\python\python.exe").Path | ||
| echo "PYO3_PYTHON=$PYO3_PYTHON" >> $env:GITHUB_ENV | ||
|
|
||
| - name: Set build environment variables (linux) | ||
| if: runner.os == 'Linux' | ||
| shell: bash | ||
| env: | ||
| # `{{ project_name }}` is your app `productName` in `tauri.conf.json` | ||
| PRODUCT_NAME: "{{ project_name }}" | ||
| run: | | ||
| PYO3_PYTHON=$(realpath ./src-tauri/pyembed/python/bin/python3) | ||
| RUSTFLAGS=" \ | ||
| -C link-arg=-Wl,-rpath,\$ORIGIN/../lib/$PRODUCT_NAME/lib \ | ||
| -L $(realpath ./src-tauri/pyembed/python/lib)" | ||
|
|
||
| echo "PYO3_PYTHON=$PYO3_PYTHON" >> $GITHUB_ENV | ||
| echo "RUSTFLAGS=$RUSTFLAGS" >> $GITHUB_ENV | ||
|
|
||
| - name: Set build environment variables (macos) | ||
| if: runner.os == 'macOS' | ||
| shell: bash | ||
| run: | | ||
| PYO3_PYTHON=$(realpath ./src-tauri/pyembed/python/bin/python3) | ||
| RUSTFLAGS=" \ | ||
| -C link-arg=-Wl,-rpath,@executable_path/../Resources/lib \ | ||
| -L $(realpath ./src-tauri/pyembed/python/lib)" | ||
|
|
||
| echo "PYO3_PYTHON=$PYO3_PYTHON" >> $GITHUB_ENV | ||
| echo "RUSTFLAGS=$RUSTFLAGS" >> $GITHUB_ENV | ||
|
|
||
| - name: Build and bundle the app | ||
| uses: tauri-apps/tauri-action@v0 | ||
| env: | ||
| GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} | ||
| with: | ||
| tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. | ||
| releaseName: "App v__VERSION__" | ||
| releaseBody: "See the assets to download this version and install." | ||
| releaseDraft: true | ||
| includeDebug: true # Optional, disable to speed up the build | ||
| args: {% raw %}'--target ${{ matrix.target }} --config src-tauri/tauri.bundle.json --verbose'{% endraw %} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.