Skip to content

Commit

Permalink
Merge branch 'andrew_testing' into feat/PR_ScreenShot_Bot
Browse files Browse the repository at this point in the history
  • Loading branch information
MuhammadHassan03 authored Aug 19, 2024
2 parents 5b23894 + e7d1eff commit 5baa47d
Show file tree
Hide file tree
Showing 341 changed files with 7,246 additions and 4,142 deletions.
41 changes: 41 additions & 0 deletions .github/actions/find-or-create-comment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Creates a comment to show native preview build status
# Or finds the comment if it exists
# Exposes the comment id in env in either case
name: Find or create comment
description: 'Finds the comment of build status or create one. Outputs the comment id.'

inputs:
github-token:
description: 'Github token'
required: true

runs:
using: 'composite'
steps:
- name: Find or create comment
uses: actions/github-script@v6
with:
github-token: ${{ inputs.github-token }}
script: |
const buildName = '${{ env.build-name }}';
const commentMagicPrefix = '${{ env.comment-unique-magic-prefix }}';
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(commentMagicPrefix));
if (existingComment) {
core.exportVariable('comment_id', existingComment.id)
} else {
const commentBody = `${commentMagicPrefix}\n🚀 ${buildName} build has 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.exportVariable('comment_id', commentId)
}
39 changes: 39 additions & 0 deletions .github/actions/update-native-preview-build-status/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Update build status
description: 'Updates build status comment with the build results'

inputs:
github-token:
description: 'Github token'
required: true
build-outcome:
description: 'Build outcome'
required: true

runs:
using: 'composite'
steps:
- name: Update build status
uses: actions/github-script@v6
with:
github-token: ${{ inputs.github-token }}
script: |
const commentId = '${{ env.comment_id }}';
const buildOutcome = '${{ inputs.build-outcome }}';
const buildStatus = buildOutcome == 'success' ? 'completed' : 'failed';
const buildName = '${{ env.build-name }}';
const workflowUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
let commentBody = `${{ env.comment-unique-magic-prefix }}\n${buildName} build ${buildStatus}!`;
if (buildOutcome == 'success') {
commentBody += `\nYou can download the ${buildName} 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
});
Original file line number Diff line number Diff line change
@@ -1,85 +1,83 @@
name: android-preview-build-local
name: tauri-build

on:
push:
branches: ['**']
pull_request:
branches: ['**']

concurrency:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


jobs:
update:
name: EAS Android Build Local
runs-on: ubuntu-latest
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 EXPO_TOKEN
- name: Check for GITHUB_TOKEN
run: |
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets."
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@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: lts/*
cache: yarn

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable

- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Add macOS-specific Rust targets
if: matrix.platform == 'macos-latest'
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin

- name: Export secrets as environment variables
env:
JSON_SECRETS: '${{ toJSON(secrets) }}'
- name: Install dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
eval "$(jq -r 'to_entries | map("export \(.key)=\(.value|tostring)") | .[]' <<< "$JSON_SECRETS")"
- name: Install dependencies
uses: ./.github/actions/install-deps
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Prebuild
run: |
echo "Using Mapbox Token: $MAPBOX_DOWNLOADS_TOKEN"
export MAPBOX_DOWNLOADS_TOKEN=${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}
yarn run prebuild:expo
- name: Install frontend dependencies
run: yarn install

- name: Create preview
id: build
run: |
echo "Using Mapbox Token: $MAPBOX_DOWNLOADS_TOKEN"
export MAPBOX_DOWNLOADS_TOKEN=${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}
eas build --platform android --profile preview --local
apk_path=$(find . -name '*.apk')
echo "APK Path: ${apk_path}"
echo "apk_path=${apk_path}" >> $GITHUB_ENV
working-directory: apps/expo
- name: Build and Publish Tauri App
uses: tauri-apps/[email protected]
env:
DEBUG: 'true'
continue-on-error: true

- name: Upload APK
uses: actions/upload-artifact@v3
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: android-apk
path: /home/runner/work/PackRat/PackRat/apps/expo/build-*.apk
# 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'
Expand All @@ -100,7 +98,7 @@ jobs:
if (existingComment) {
core.setOutput('comment_id', existingComment.id);
} else {
const commentBody = `${commentIdentifier}\n🚀 Android APK build started... Please wait for the results! 🕐`;
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,
Expand All @@ -118,14 +116,14 @@ jobs:
script: |
const commentIdentifier = '<!-- build_results -->';
const commentId = '${{ steps.find_or_create_comment.outputs.comment_id }}';
const buildOutcome = '${{ steps.build.outcome }}';
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}\nAndroid APK build ${buildStatus}!`;
let commentBody = `${commentIdentifier}\nTauri build ${buildStatus}!`;
if (buildOutcome == 'success') {
commentBody += `\nYou can download the APK file from the following link:\n${workflowUrl}#artifacts`;
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.';
}
Expand Down
53 changes: 0 additions & 53 deletions .github/workflows/android-build-manual.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/build.yml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/eas-build-manual.yml

This file was deleted.

Loading

0 comments on commit 5baa47d

Please sign in to comment.