Skip to content

Commit

Permalink
fix: rework release workflow
Browse files Browse the repository at this point in the history
- tags are now v123 or v123beta
- trigger store release on release action
  • Loading branch information
paulschreiber committed Jul 10, 2024
1 parent f5f79ed commit c54ade0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-shared-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
android-build:
name: Android Build
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment || 'staging' }}
environment: ${{ !contains(github.ref_name, 'beta') && 'production' || 'staging' }}
env:
STRICT: ${{ inputs.STRICT }}
ENV: ${{ vars.ENV }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-shared-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
ios-build:
name: iOS Build
runs-on: macos-14
environment: ${{ github.event.inputs.environment || 'staging' }}
environment: ${{ !contains(github.ref_name, 'beta') && 'production' || 'staging' }}
env:
STRICT: ${{ inputs.STRICT }}
ENV: ${{ vars.ENV }}
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
name: Release

on:
workflow_dispatch:
inputs:
environment:
description: 'Release environment'
type: choice
required: true
default: staging
options:
- staging
- production
push:
tags:
- 'v[0-9]+'
release:
types: [published]

jobs:
ios-build-release:
Expand Down
16 changes: 8 additions & 8 deletions dev-client/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {withAppBuildGradle} from 'expo/config-plugins';

import {fromEntries} from 'terraso-client-shared/utils';

const BUILD_REGEX = /^v?[0-9]+$/g;
const BUILD_REGEX = /^v?(?<build>[0-9]+)(?<tag>beta)?$/;

const STRICT = process.env.STRICT === 'true';

Expand Down Expand Up @@ -65,14 +65,14 @@ let buildNumber = 1;
const APP_BUILD = process.env.APP_BUILD;

if (typeof APP_BUILD === 'string') {
if (!BUILD_REGEX.test(APP_BUILD)) {
throw Error(`invalid app build: ${APP_BUILD}. should be v[0-9]+ or [0-9]+`);
}
if (APP_BUILD[0] === 'v') {
buildNumber = parseInt(APP_BUILD.slice(1), 10);
} else {
buildNumber = parseInt(APP_BUILD, 10);
const result = BUILD_REGEX.exec(APP_BUILD);
if (result === null) {
throw Error(
`invalid app build: ${APP_BUILD}. should be v[0-9]+ or v[0-9]+beta`,
);
}
buildNumber = parseInt(result.groups!.build, 10);

ENV_CONFIG.APP_BUILD = buildNumber.toString();
}

Expand Down

0 comments on commit c54ade0

Please sign in to comment.