From db075eb2910d5bfc69c8fb609ba0bfc81aba8447 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 28 Nov 2021 21:19:49 +0100 Subject: [PATCH] [ci skip] Split unit testing and beta workflows - master: test - stable: beta --- .github/workflows/beta.yml | 27 +++++---------------------- .github/workflows/test.yml | 31 +++++++++++++++++++++++++++++++ scripts/commit-release.sh | 6 +++++- scripts/push-stable.sh | 11 +++++++++++ 4 files changed, 52 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100755 scripts/push-stable.sh diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 8d1bf86a..d365a3bc 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -3,12 +3,7 @@ name: Public Beta on: push: branches: - - 'master' - 'stable' - #tags: - # - 'v*-b*' - #tags-ignore: - # - 'v*-*' env: APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }} @@ -27,21 +22,7 @@ env: CHANGELOG_PREFACE: ${{ secrets.CHANGELOG_PREFACE }} jobs: - run_tests: - if: github.ref != 'refs/heads/stable' - runs-on: macos-11 - timeout-minutes: 20 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Prepare build - uses: ./.github/actions/prepare-build-app - - name: Run tests - run: | - bundle exec fastlane --env mac,beta test_target build_upload_ios: - if: github.ref == 'refs/heads/stable' runs-on: macos-11 timeout-minutes: 60 steps: @@ -59,7 +40,6 @@ jobs: export PILOT_IPA="dist/ios/Passepartout.ipa" bundle exec fastlane --env ios,beta store_beta build_upload_mac: - if: github.ref == 'refs/heads/stable' runs-on: macos-11 timeout-minutes: 60 steps: @@ -77,7 +57,6 @@ jobs: export PILOT_PKG="dist/mac/Passepartout.pkg" bundle exec fastlane --env mac,beta store_beta release_public_beta: - if: github.ref == 'refs/heads/stable' runs-on: ubuntu-latest needs: [build_upload_ios, build_upload_mac] environment: @@ -105,8 +84,12 @@ jobs: # export PILOT_APP_VERSION=`ci/version-number.sh mac` # export PILOT_BUILD_NUMBER=`ci/build-number.sh mac` # bundle exec fastlane --env mac,beta store_beta + - name: Tag release + run: | + export VERSION=`ci/version-number.sh ios` + export BUILD=`ci/version-number.sh ios` + git tag "v$VERSION-b$BUILD" && git push --tags submit_for_app_review: - if: github.ref == 'refs/heads/stable' runs-on: ubuntu-latest needs: release_public_beta environment: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..741a7241 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,31 @@ +name: Unit Tests + +on: + push: + branches-ignore: + - 'stable' + +env: + APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }} + FASTLANE_USERNAME: ${{ secrets.FASTLANE_USERNAME }} + FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }} + MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + MATCH_GIT_URL: ${{ secrets.MATCH_GIT_URL }} + MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }} + MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} + MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} + +jobs: + run_tests: + runs-on: macos-11 + timeout-minutes: 20 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Prepare build + uses: ./.github/actions/prepare-build-app + - name: Run tests + run: | + bundle exec fastlane --env mac,beta test_target diff --git a/scripts/commit-release.sh b/scripts/commit-release.sh index 65dd7c65..4387aa0f 100755 --- a/scripts/commit-release.sh +++ b/scripts/commit-release.sh @@ -10,6 +10,10 @@ DATE=`date "+%Y-%m-%d"` CHANGELOG_GLOB="Passepartout/App/*/CHANGELOG.md" COMMIT_MESSAGE="Set release date" TAG_MESSAGE="Release" +TAG_SIGN="--sign" +if [[ $1 == "no-sign" ]]; then + TAG_SIGN="" +fi sed -i '' -E "s/^.*Beta.*$/## $VERSION ($DATE)/" $CHANGELOG_GLOB if ! git commit -am "$COMMIT_MESSAGE"; then @@ -18,7 +22,7 @@ if ! git commit -am "$COMMIT_MESSAGE"; then exit fi -if ! git tag -as "v$VERSION" -m "$TAG_MESSAGE"; then +if ! git tag $TAG_SIGN -a "v$VERSION" -m "$TAG_MESSAGE"; then echo "Failed to tag release" git reset --hard HEAD^ exit diff --git a/scripts/push-stable.sh b/scripts/push-stable.sh new file mode 100755 index 00000000..8ae240fa --- /dev/null +++ b/scripts/push-stable.sh @@ -0,0 +1,11 @@ +#!/bin/sh +CURRENT_BRANCH=`git branch --show-current` +if [[ $CURRENT_BRANCH != "master" ]]; then + echo "Not on master branch" + exit +fi +if !(git checkout stable && git merge master && git push github); then + echo "Error while pushing stable" + exit +fi +git checkout master