Skip to content

Commit 42db0d0

Browse files
BrantalikPPetr Brantalík
andauthored
chore: new release process (#25)
* chore: release process * chore: release-it * fix: update pnpm-lock * chore: update app.config * chore: build actions * fix: move release deps * fix: removed unrelated deps * chore: revision * chore: jira integration * chore: slack and dev build distribution * chore: minor fix * chore: minor fix * chore: minor fix * chore: cloudflare * chore: ota udpate url * chore: eas setup --------- Co-authored-by: Petr Brantalík <grounipteam@gmail.com>
1 parent ef5258b commit 42db0d0

25 files changed

+3619
-276
lines changed

.github/actions/build/action.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build Application
2+
description: 'Build the application using EAS'
3+
inputs:
4+
environment:
5+
required: true
6+
description: 'The environment to build for'
7+
platform:
8+
required: true
9+
description: 'The platform to build for'
10+
auto_submit:
11+
required: true
12+
description: 'Whether to auto-submit to stores'
13+
14+
runs:
15+
using: composite
16+
steps:
17+
- name: Build for EAS
18+
run: |
19+
BUILD_COMMAND="eas build --platform ${{ inputs.platform }} --profile ${{ inputs.environment }} --non-interactive"
20+
if [[ "${{ inputs.auto_submit }}" == "true" ]]; then
21+
BUILD_COMMAND="$BUILD_COMMAND --auto-submit"
22+
echo "Auto-submitting to stores"
23+
fi
24+
eval $BUILD_COMMAND
25+
shell: bash
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 'Create Hotfix Tag'
2+
description: 'Creates a new Git tag for a hotfix based on the previous tag'
3+
inputs:
4+
version:
5+
description: 'Current version number'
6+
required: true
7+
outputs:
8+
hotfix_tag:
9+
description: 'The new hotfix tag'
10+
value: ${{ steps.create_tag.outputs.hotfix_tag }}
11+
12+
runs:
13+
using: 'composite'
14+
steps:
15+
- name: Get previous tag and create hotfix tag
16+
id: create_tag
17+
shell: bash
18+
run: |
19+
# Get the current version
20+
current_version="${{ inputs.version }}"
21+
22+
# Get the latest tag that matches the current version
23+
latest_tag=$(git tag -l "v${current_version}*" | sort -V | tail -n 1)
24+
25+
if [[ $latest_tag == *"-hotfix"* ]]; then
26+
# If the latest tag is already a hotfix, increment the hotfix number
27+
hotfix_number=$(echo $latest_tag | grep -oP 'hotfix.\K\d+')
28+
new_hotfix_number=$((hotfix_number + 1))
29+
hotfix_tag="v${current_version}-hotfix.${new_hotfix_number}"
30+
else
31+
# If it's not a hotfix yet, create the first hotfix
32+
hotfix_tag="v${current_version}-hotfix.1"
33+
fi
34+
35+
echo "hotfix_tag=${hotfix_tag}" >> $GITHUB_OUTPUT
36+
37+
# Create and push the new tag
38+
git config user.name github-actions
39+
git config user.email github-actions@github.com
40+
git tag -a "${hotfix_tag}" -m "Hotfix release ${hotfix_tag}"
41+
git push origin "${hotfix_tag}"
42+
43+
echo "Created and pushed new tag: ${hotfix_tag}"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'Increment Build Number'
2+
description: 'Increments the build number or sets it to 1 if not present'
3+
inputs:
4+
gh_token:
5+
description: 'GitHub token for authentication'
6+
required: true
7+
current_build_number:
8+
description: 'The current build number'
9+
required: false
10+
default: '0'
11+
outputs:
12+
build_number:
13+
description: 'The incremented build number'
14+
value: ${{ steps.increment.outputs.build_number }}
15+
16+
runs:
17+
using: 'composite'
18+
steps:
19+
- name: Increment build number
20+
id: increment
21+
shell: bash
22+
run: |
23+
if [[ -z "${{ inputs.current_build_number }}" || "${{ inputs.current_build_number }}" == "0" ]]; then
24+
build_number=1
25+
else
26+
build_number=$((${{ inputs.current_build_number }} + 1))
27+
fi
28+
gh variable set BUILD_NUMBER -b "${build_number}"
29+
echo "build_number=${build_number}" >> $GITHUB_OUTPUT
30+
env:
31+
GH_TOKEN: ${{ inputs.gh_token }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: OTA Update
2+
description: 'Perform an OTA update'
3+
inputs:
4+
channel:
5+
required: true
6+
description: 'The environment to update'
7+
version:
8+
required: true
9+
description: 'The version number'
10+
build_number:
11+
required: true
12+
description: 'The build number'
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Set environment variables
17+
shell: bash
18+
run: |
19+
echo "EXPO_PUBLIC_APP_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
20+
echo "EXPO_PUBLIC_BUILD_NUMBER=${{ inputs.build_number }}" >> $GITHUB_ENV
21+
22+
- name: Perform OTA Update
23+
shell: bash
24+
run: |
25+
eas update --channel ${{ inputs.channel }} \
26+
--message "Update ${{ inputs.channel }} to ${{ inputs.version }} (build ${{ inputs.build_number }})"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Generate Release Notes'
2+
description: 'Generate release notes using release-it'
3+
inputs:
4+
version:
5+
description: 'Version to release'
6+
required: true
7+
gh_token:
8+
description: 'GitHub token'
9+
required: true
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- name: Generate Changelog and Create Release
14+
shell: bash
15+
run: npx release-it ${{ inputs.version }} --ci --no-increment
16+
env:
17+
GITHUB_TOKEN: ${{ inputs.gh_token }}

.github/actions/setup/action.yml

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,40 @@
1-
# Reusable composition action preparing all the pipes related workers.
2-
# It's a good idea to move all the repeated setup steps in here, such as setting up Expo.
3-
4-
name: Shared setup steps composition
5-
description: 'This action provides the shared setups steps'
1+
name: Setup Environment
2+
description: 'Set up Node.js, pnpm, Expo CLI'
3+
inputs:
4+
EXPO_TOKEN:
5+
required: true
6+
description: 'Expo API key'
67

78
runs:
8-
using: 'composite'
9-
9+
using: composite
1010
steps:
11+
- uses: actions/setup-node@v4
12+
with:
13+
node-version: 20
14+
1115
- name: Install pnpm
12-
uses: pnpm/action-setup@v3
16+
uses: pnpm/action-setup@v4
17+
18+
- name: Get pnpm store directory
19+
id: pnpm-cache
20+
shell: bash
21+
run: |
22+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
23+
24+
- uses: actions/cache@v4
25+
name: Setup pnpm cache
1326
with:
14-
version: 9
15-
run_install: false
27+
path: ${{ env.STORE_PATH }}
28+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
29+
restore-keys: |
30+
${{ runner.os }}-pnpm-store-
1631
17-
- name: Setup Node
18-
uses: actions/setup-node@v4
32+
- uses: expo/expo-github-action@v8
1933
with:
20-
node-version: 20
21-
cache: 'pnpm'
34+
eas-version: latest
35+
token: ${{ inputs.EXPO_TOKEN }}
36+
packager: pnpm
2237

23-
- name: Install dependencies
38+
- name: Install Dependencies
39+
run: pnpm install --frozen-lockfile
2440
shell: bash
25-
run: pnpm install --frozen-lockfile --ignore-scripts
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'Update EAS JSON'
2+
description: 'Updates eas.json with environment-specific variables'
3+
inputs:
4+
environment:
5+
description: 'Environment (e.g. production, staging)'
6+
required: true
7+
version:
8+
description: 'App version'
9+
required: true
10+
build_number:
11+
description: 'Build number'
12+
required: true
13+
vars:
14+
description: 'JSON string of variables'
15+
required: true
16+
runs:
17+
using: 'composite'
18+
steps:
19+
- name: Update eas.json
20+
shell: bash
21+
run: |
22+
jq --arg env "${{ inputs.environment }}" \
23+
--arg version "${{ inputs.version }}" \
24+
--arg build "${{ inputs.build_number }}" \
25+
--argjson vars '${{ inputs.vars }}' \
26+
'.build[$env].env += ($vars | with_entries(select(.key | startswith("EXPO_PUBLIC_"))))
27+
| .build[$env].env += {
28+
"EXPO_PUBLIC_APP_ENV": $env,
29+
"EXPO_PUBLIC_BUILD_NUMBER": $build,
30+
"EXPO_PUBLIC_APP_VERSION": $version
31+
}' eas.json > eas.json.tmp && mv eas.json.tmp eas.json
32+
echo "Updated eas.json:"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Version Management
2+
description: 'Manage version'
3+
inputs:
4+
version_bump:
5+
required: true
6+
description: 'Type of version bump'
7+
increment:
8+
required: true
9+
description: 'Whether to increment the version'
10+
outputs:
11+
version:
12+
description: 'The version number'
13+
value: ${{ steps.version_management.outputs.version }}
14+
runs:
15+
using: composite
16+
steps:
17+
- name: Version Management
18+
id: version_management
19+
run: |
20+
CURRENT_VERSION=$(node -p "require('./package.json').version")
21+
22+
if [[ "${{ inputs.increment }}" == "true" && "${{ inputs.version_bump }}" != "none" ]]; then
23+
git config user.name github-actions
24+
git config user.email github-actions@github.com
25+
npm version ${{ inputs.version_bump }} -m "Bump version to %s" --no-git-tag-version
26+
NEW_VERSION=$(node -p "require('./package.json').version")
27+
else
28+
NEW_VERSION=$CURRENT_VERSION
29+
fi
30+
31+
echo "version=${NEW_VERSION}" >> $GITHUB_OUTPUT
32+
shell: bash

.github/workflows/ci-code-quality.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ jobs:
2020
- name: Run TypeScript
2121
run: pnpm type:check
2222

23-
# - name: Run Tests
24-
# run: yarn test
23+
- name: Run Tests
24+
run: pnpm test
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Create Dev Build
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: 'Build Type'
8+
required: true
9+
default: 'dev-sim'
10+
type: choice
11+
options:
12+
- dev
13+
- dev-sim
14+
platform:
15+
description: 'Platform'
16+
required: true
17+
default: 'all'
18+
type: choice
19+
options:
20+
- all
21+
- ios
22+
- android
23+
24+
jobs:
25+
create-dev-build:
26+
runs-on: ubuntu-latest
27+
environment: dev
28+
29+
steps:
30+
- uses: actions/checkout@v3
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Setup Environment
35+
uses: ./.github/actions/setup
36+
with:
37+
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
38+
39+
- name: Version Management
40+
uses: ./.github/actions/version
41+
id: version
42+
with:
43+
version_bump: 'none'
44+
increment: false
45+
46+
- name: Update eas.json
47+
uses: ./.github/actions/update-eas
48+
with:
49+
environment: dev
50+
version: ${{ steps.version.outputs.version }}
51+
build_number: ${{ vars.BUILD_NUMBER }}
52+
vars: ${{ toJson(vars) }}
53+
54+
- name: Build Application
55+
uses: ./.github/actions/build
56+
with:
57+
environment: ${{ github.event.inputs.environment }}
58+
platform: ${{ github.event.inputs.platform }}
59+
auto_submit: false
60+
61+
- name: Revert eas.json changes
62+
if: always()
63+
run: |
64+
git restore eas.json

0 commit comments

Comments
 (0)