Skip to content

Merge branch 'andrew_testing' into feat/integrate_servers #36

Merge branch 'andrew_testing' into feat/integrate_servers

Merge branch 'andrew_testing' into feat/integrate_servers #36

Workflow file for this run

name: tauri-build
on:
push:
branches: ['**']
pull_request:
branches: ['**']
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
publish-tauri:
name: Tauri Build and Publish
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
arch: 'arm64'
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest'
arch: 'x64'
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04'
args: ''
- platform: 'windows-latest'
args: ''
permissions:
contents: read
pull-requests: write
steps:
- name: Check for GITHUB_TOKEN
run: |
if [ -z "${{ secrets.GITHUB_TOKEN }}" ]; then
echo "You must provide a GITHUB_TOKEN secret for this repository."
exit 1
fi
shell: bash
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: yarn
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Add macOS-specific Rust targets
if: matrix.platform == 'macos-latest'
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
- name: Install dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: yarn install
- name: Build and Publish Tauri App
uses: tauri-apps/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# tagName: app-v__VERSION__
# releaseName: 'App v__VERSION__'
# releaseBody: 'See the assets to download this version and install.'
# releaseDraft: true
# prerelease: false
args: ${{ matrix.args }}
- name: Find or create comment
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
id: find_or_create_comment
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const commentIdentifier = '<!-- build_results -->';
const comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
const existingComment = comments.data.find(comment => comment.body.startsWith(commentIdentifier));
if (existingComment) {
core.setOutput('comment_id', existingComment.id);
} else {
const commentBody = `${commentIdentifier}\n🚀 Tauri build started... Please wait for the results! 🕐`;
const { data: { id: commentId } } = await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
core.setOutput('comment_id', commentId);
}
- name: Update PR comment
if: always() && github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const commentIdentifier = '<!-- build_results -->';
const commentId = '${{ steps.find_or_create_comment.outputs.comment_id }}';
const buildOutcome = '${{ job.status }}';
const buildStatus = buildOutcome == 'success' ? 'completed' : 'failed';
const workflowUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
let commentBody = `${commentIdentifier}\nTauri build ${buildStatus}!`;
if (buildOutcome == 'success') {
commentBody += `\nYou can download the build artifacts from the following link:\n${workflowUrl}#artifacts`;
} else {
commentBody += '\nPlease check the workflow logs for more details on the build failure.';
}
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: commentId,
body: commentBody
});