Skip to content

Commit a3dc3bc

Browse files
feat: automated mobile deployments rd2 (selfxyz#498)
* migrate build logic from previous branch * fix command * move .actrc file * clean up * use env vars * setup provisioning profile path within action * fix flow * fix fastfile flow and update react native * disable play store uploading * hard code xcode version * fixes * more provisioning debugging * fix keychain path * set keychain to what was created by the github action * attempt to build again * test fix * print xcode build settings * debug ios build * fix xcargs path * use manual code signing * save wip * fix building locally * fix variable * save wip * clean up long comand * clean up * install bundle and gems * install pods * fix pod installation * sort * better naming * fix android issues * update lock * clean up artifacts * format * save wip slack upload logic * prettier * fix indent * save wip * save wip * save wip * save wip * save wip * clean up * simplify slack calls * revert slack logic * save working slack upload example * make title nicer * clean up slack upload * upload paths * enable github commit * fix path * fix commit step * fix git committing * update markdown * fix git commit rule * better commit message * chore: incrementing ios build number for version 2.4.9 [skip ci] * better name --------- Co-authored-by: Self GitHub Actions <action@github.com>
1 parent 5c45028 commit a3dc3bc

24 files changed

Lines changed: 2722 additions & 161 deletions

File tree

.actrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--container-architecture linux/amd64
2+
--platform macos-latest=catthehacker/ubuntu:runner-latest
3+
--secret-file ./app/fastlane/.env.secrets
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Get Version from package.json
2+
3+
description: "Gets the version from package.json and sets it as an environment variable"
4+
5+
inputs:
6+
app_path:
7+
description: "Path to the app directory"
8+
required: true
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Get version from package.json
14+
shell: bash
15+
run: |
16+
VERSION=$(node -p "require('${{ inputs.app_path }}/package.json').version")
17+
echo "VERSION=$VERSION" >> $GITHUB_ENV
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Setup Mobile Environment
2+
3+
description: "Sets up the environment for mobile app builds"
4+
5+
inputs:
6+
app_path:
7+
description: "Path to the app directory"
8+
required: true
9+
node_version:
10+
description: "Node version"
11+
required: true
12+
ruby_version:
13+
description: "Ruby version"
14+
required: true
15+
workspace:
16+
description: "Workspace directory path"
17+
required: true
18+
19+
runs:
20+
using: "composite"
21+
steps:
22+
- name: Install locales and dialog for local development
23+
if: ${{ env.ACT }}
24+
shell: bash
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y locales dialog unzip
28+
29+
# for fastlane
30+
- name: Install locales and dialog
31+
if: runner.os != 'macOS'
32+
shell: bash
33+
run: |
34+
sudo locale-gen en_US.UTF-8
35+
sudo update-locale LANG=en_US.UTF-8
36+
37+
- name: Checkout repository
38+
uses: actions/checkout@v3
39+
40+
- name: Setup Ruby environment
41+
uses: ruby/setup-ruby@v1
42+
with:
43+
ruby-version: ${{ inputs.ruby_version }}
44+
45+
- name: Setup Node.js environment
46+
uses: actions/setup-node@v3
47+
with:
48+
node-version: ${{ inputs.node_version }}
49+
50+
- name: Install app dependencies
51+
shell: bash
52+
run: |
53+
cd ${{ inputs.app_path }}
54+
corepack enable
55+
yarn install
56+
yarn install-app:deploy
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Push Build Version Changes
2+
3+
description: "Commits and pushes build version changes for mobile platforms"
4+
5+
inputs:
6+
commit_message:
7+
description: "Commit message"
8+
required: true
9+
commit_paths:
10+
description: "Space-separated list of paths to check for changes (e.g. 'ios/file.txt android/another/file.xml')"
11+
required: true
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Configure Git
17+
shell: bash
18+
run: |
19+
set -e
20+
git config --global user.email "action@github.com"
21+
git config --global user.name "Self GitHub Actions"
22+
23+
- name: Commit Changes
24+
shell: bash
25+
run: |
26+
set -e
27+
set -x
28+
29+
# Restore the logic for checking specific paths existence
30+
commit_paths_input="${{ inputs.commit_paths }}"
31+
paths_to_commit=""
32+
33+
for path in $commit_paths_input; do
34+
if [ ! -e "$path" ]; then
35+
echo "Error: Path $path does not exist"
36+
exit 1
37+
fi
38+
paths_to_commit="$paths_to_commit $path"
39+
done
40+
41+
if [ -z "$paths_to_commit" ]; then
42+
echo "No valid paths provided."
43+
exit 1
44+
fi
45+
46+
# Remove leading space if present
47+
paths_to_commit=$(echo "$paths_to_commit" | sed 's/^ *//')
48+
49+
# Stage ONLY the specified paths
50+
git add $paths_to_commit
51+
52+
# Check if there are staged changes ONLY in the specified paths
53+
if git diff --staged --quiet -- $paths_to_commit; then
54+
echo "No changes to commit in the specified paths: $paths_to_commit"
55+
else
56+
echo "Changes to be committed in paths: $paths_to_commit"
57+
# Show the staged diff for the specified paths
58+
git diff --cached -- $paths_to_commit
59+
git commit -m "chore: ${{ inputs.commit_message }} [github action]"
60+
fi
61+
62+
- name: Push Changes
63+
shell: bash
64+
run: |
65+
set -e
66+
set -x
67+
68+
if git rev-parse --verify HEAD >/dev/null 2>&1; then
69+
if [[ ${{ github.ref }} == refs/pull/* ]]; then
70+
CURRENT_BRANCH=${{ github.head_ref }}
71+
else
72+
CURRENT_BRANCH=$(echo ${{ github.ref }} | sed 's|refs/heads/||')
73+
fi
74+
75+
echo "Pushing changes to branch: $CURRENT_BRANCH"
76+
# Add --autostash to handle potential unstaged changes gracefully
77+
git pull --rebase --autostash origin $CURRENT_BRANCH || {
78+
echo "Failed to pull from $CURRENT_BRANCH"
79+
exit 1
80+
}
81+
git push origin HEAD:$CURRENT_BRANCH || {
82+
echo "Failed to push to $CURRENT_BRANCH"
83+
exit 1
84+
}
85+
else
86+
echo "No new commits to push"
87+
fi

0 commit comments

Comments
 (0)