mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +00:00
Fixed IAP stub in workflows (#110)
* try using script for iap stub * typo * typo * typo * removed working dir * added comment to stub_iap.sh * checkout first * increment build number by script * Update increment_build_number.sh * fixed iap repo * stub
This commit is contained in:
parent
4bb080a144
commit
da4fcfc857
7 changed files with 41 additions and 30 deletions
8
.github/scripts/increment_build_number.sh
vendored
Normal file
8
.github/scripts/increment_build_number.sh
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
export newVersion="$1"
|
||||
|
||||
if [[ -n "$newVersion" ]]; then
|
||||
#https://stackoverflow.com/a/30214769/13167574
|
||||
perl -i -pe 's/^(version:\s+)(\d+\.\d+\.\d+)(\+)(\d+)$/$1.$ENV{'newVersion'}.$3.($4+1)/e' pubspec.yaml
|
||||
else
|
||||
echo "argument error"
|
||||
fi
|
2
.github/scripts/stub_iap.sh
vendored
Normal file
2
.github/scripts/stub_iap.sh
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# https://unix.stackexchange.com/questions/435708/regex-multiline-pattern-and-substitution-replacement
|
||||
perl -0777 -i -pe 's/( m3_lightmeter_iap:\n)( git:\n url: "https:\/\/github.com\/vodemn\/m3_lightmeter_iap"\n ref: main)/$1 path: iap/sg' pubspec.yaml
|
11
.github/workflows/build_apk.yml
vendored
11
.github/workflows/build_apk.yml
vendored
|
@ -27,6 +27,10 @@ jobs:
|
|||
runs-on: macos-11
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Connect private iap package
|
||||
uses: webfactory/ssh-agent@v0.8.0
|
||||
if: ${{ inputs.include-iap }}
|
||||
|
@ -35,12 +39,7 @@ jobs:
|
|||
|
||||
- name: Override iap package with stub
|
||||
if: ${{ !inputs.include-iap }}
|
||||
run: |
|
||||
echo "\ndependency_overrides:\n m3_lightmeter_iap:\n path: iap" >> pubspec.yaml
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
run: bash ./.github/scripts/stub_iap.sh
|
||||
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
|
|
15
.github/workflows/create_release.yml
vendored
15
.github/workflows/create_release.yml
vendored
|
@ -46,6 +46,10 @@ jobs:
|
|||
runs-on: macos-11
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Connect private iap package
|
||||
uses: webfactory/ssh-agent@v0.8.0
|
||||
if: ${{ inputs.include-iap }}
|
||||
|
@ -54,12 +58,7 @@ jobs:
|
|||
|
||||
- name: Override iap package with stub
|
||||
if: ${{ !inputs.include-iap }}
|
||||
run: |
|
||||
echo "\ndependency_overrides:\n m3_lightmeter_iap:\n path: iap" >> pubspec.yaml
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
run: bash ./.github/scripts/stub_iap.sh
|
||||
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
|
@ -98,7 +97,7 @@ jobs:
|
|||
# Therefore here we have to increment it as well to build an apk with the same build number.
|
||||
- name: Increment build number & replace version number
|
||||
if: ${{ inputs.github-release }}
|
||||
run: perl -i -pe 's/^(version:\s+)(\d+\.\d+\.\d+)(\+)(\d+)$/$1."${{ github.event.inputs.version }}".$3.($4+1)/e' pubspec.yaml
|
||||
run: bash ./.github/scripts/increment_build_number.sh ${{ github.event.inputs.version }}
|
||||
|
||||
- name: Install Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
|
@ -160,7 +159,7 @@ jobs:
|
|||
submodules: recursive
|
||||
|
||||
- name: Increment build number & replace version number
|
||||
run: perl -i -pe 's/^(version:\s+)(\d+\.\d+\.\d+)(\+)(\d+)$/$1."${{ github.event.inputs.version }}".$3.($4+1)/e' pubspec.yaml
|
||||
run: bash ./.github/scripts/increment_build_number.sh ${{ github.event.inputs.version }}
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
|
|
19
.github/workflows/pr_check.yml
vendored
19
.github/workflows/pr_check.yml
vendored
|
@ -11,30 +11,25 @@ on:
|
|||
pull_request:
|
||||
branches: ["main"]
|
||||
|
||||
env:
|
||||
# Stub iap package if this worlflow is running from the PR from a fork
|
||||
STUB_IAP: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
|
||||
|
||||
jobs:
|
||||
analyze_and_test:
|
||||
name: Analyze & test
|
||||
runs-on: macos-11
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Connect private iap package
|
||||
uses: webfactory/ssh-agent@v0.8.0
|
||||
if: !env.STUB_IAP
|
||||
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.M3_LIGHTMETER_IAP_KEY }}
|
||||
|
||||
- name: Override iap package with stub
|
||||
if: env.STUB_IAP
|
||||
run: |
|
||||
echo "\ndependency_overrides:\n m3_lightmeter_iap:\n path: iap" >> pubspec.yaml
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
|
||||
run: bash ./.github/scripts/stub_iap.sh
|
||||
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
enum IAPProductStatus {
|
||||
purchasable,
|
||||
pending,
|
||||
purchased,
|
||||
}
|
||||
|
||||
enum IAPProductType { paidFeatures }
|
||||
|
||||
class IAPProduct {
|
||||
IAPProduct();
|
||||
abstract class IAPProduct {
|
||||
const IAPProduct._();
|
||||
|
||||
IAPProductStatus get status => IAPProductStatus.purchasable;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class IAPProducts extends InheritedModel<IAPProductType> {
|
|||
super.key,
|
||||
});
|
||||
|
||||
static IAPProduct? of(BuildContext context, IAPProductType type) => null;
|
||||
static IAPProduct? productOf(BuildContext context, IAPProductType type) => null;
|
||||
|
||||
static bool isPurchased(BuildContext context, IAPProductType type) => false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue