From 13896c739622b1b17e01dbfbcc2acd4be2bb6d05 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Tue, 30 Nov 2021 11:27:05 +0100 Subject: [PATCH] Rethink beta/release workflow - Drop stable branch - Run tests on all branches except test/* - Publish beta manually - Beta - Leave "Unreleased" in CHANGELOG - Add TestFlight URL - Tag beta after successful deployment - Release - Enable GPG signing - Commit version and date in CHANGELOG - Tag release - Create GitHub release with merged notes Show all workflows in README. --- .github/workflows/beta.yml | 50 +++++++++++++++++++++++++++--- .github/workflows/test.yml | 2 +- README.md | 4 ++- Submodules/fastlane-ci-templates | 2 +- scripts/after-beta.sh | 4 --- scripts/{ => ci}/commit-release.sh | 16 ++++------ scripts/commit-beta.sh | 11 +++---- scripts/push-stable.sh | 11 ------- 8 files changed, 61 insertions(+), 39 deletions(-) delete mode 100755 scripts/after-beta.sh rename scripts/{ => ci}/commit-release.sh (66%) delete mode 100755 scripts/push-stable.sh diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index d365a3bc..f966ab6b 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -1,9 +1,7 @@ name: Public Beta on: - push: - branches: - - 'stable' + workflow_dispatch: env: APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }} @@ -61,6 +59,7 @@ jobs: needs: [build_upload_ios, build_upload_mac] environment: name: public_beta + url: https://testflight.apple.com/join/K71mtLjZ env: PILOT_USERNAME: ${{ secrets.PILOT_USERNAME }} PILOT_GROUPS: ${{ secrets.PILOT_GROUPS }} @@ -84,7 +83,7 @@ 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 + - name: Tag beta run: | export VERSION=`ci/version-number.sh ios` export BUILD=`ci/version-number.sh ios` @@ -116,3 +115,46 @@ jobs: export DELIVER_APP_VERSION=`ci/version-number.sh mac` export DELIVER_BUILD_NUMBER=`ci/build-number.sh mac` bundle exec fastlane --env mac store_review add_id_info_uses_idfa:false + release_to_app_store: + runs-on: ubuntu-latest + needs: submit_for_app_review + environment: + name: app_store + steps: + - name: Check out repository + uses: actions/checkout@v2 + with: + submodules: true + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v4 + with: + gpg_private_key: ${{ secrets.GPG_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + git_user_signingkey: true + git_commit_gpgsign: true + git_tag_gpgsign: true + git_push_gpgsign: false + - name: Tag release + id: tag_release + run: | + scripts/ci/commit-release.sh + git pull && git push && git push --tags + echo "::set-output name=tag_name::`git describe`" + - name: Assemble notes + run: | + export RELEASE_NOTES="release-notes.txt" + echo "# App Store" >$RELEASE_NOTES + echo >>$RELEASE_NOTES + echo "## iOS" >>$RELEASE_NOTES + echo >>$RELEASE_NOTES + cat Passepartout/App/iOS/fastlane/metadata/en-US/release_notes.txt >>$RELEASE_NOTES + echo "## macOS" >>$RELEASE_NOTES + echo >>$RELEASE_NOTES + cat Passepartout/App/macOS/fastlane/metadata/en-US/release_notes.txt >>$RELEASE_NOTES + - name: Publish release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.tag_release.outputs.tag_name }} + body_path: release-notes.txt + files: | + release-notes.txt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 741a7241..d7fd04fd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ name: Unit Tests on: push: branches-ignore: - - 'stable' + - 'test/*' env: APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }} diff --git a/README.md b/README.md index bd0e1bc8..f1cdf3c4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@ ![macOS 10.15+](https://img.shields.io/badge/macOS-10.15+-green.svg) [![TunnelKit 4.0](https://img.shields.io/badge/TunnelKit-4.0-d69c68.svg)][dep-tunnelkit] [![License GPLv3](https://img.shields.io/badge/License-GPLv3-lightgray.svg)](LICENSE) -[![GitHub Actions](https://github.com/passepartoutvpn/passepartout-apple/actions/workflows/beta.yml/badge.svg)](https://github.com/passepartoutvpn/passepartout-apple/actions/workflows/beta.yml) + +[![Unit Tests](https://github.com/passepartoutvpn/passepartout-apple/actions/workflows/test.yml/badge.svg)](https://github.com/passepartoutvpn/passepartout-apple/actions/workflows/test.yml) +[![Public Beta](https://github.com/passepartoutvpn/passepartout-apple/actions/workflows/beta.yml/badge.svg)](https://github.com/passepartoutvpn/passepartout-apple/actions/workflows/beta.yml) # [Passepartout][about-website] diff --git a/Submodules/fastlane-ci-templates b/Submodules/fastlane-ci-templates index 26620d59..657ed169 160000 --- a/Submodules/fastlane-ci-templates +++ b/Submodules/fastlane-ci-templates @@ -1 +1 @@ -Subproject commit 26620d596ca3bbc25be6cc2efa2b52797021379a +Subproject commit 657ed1691e0effe4569ad1fd2c99da9b25f1dda7 diff --git a/scripts/after-beta.sh b/scripts/after-beta.sh deleted file mode 100755 index 4b45ec57..00000000 --- a/scripts/after-beta.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -CHANGELOG_GLOB="Passepartout/App/*/CHANGELOG.md" - -sed -i '' -E "s/^.*Beta.*$/## Unreleased/g" $CHANGELOG_GLOB diff --git a/scripts/commit-release.sh b/scripts/ci/commit-release.sh similarity index 66% rename from scripts/commit-release.sh rename to scripts/ci/commit-release.sh index 12721bdd..7e4516ec 100755 --- a/scripts/commit-release.sh +++ b/scripts/ci/commit-release.sh @@ -1,8 +1,8 @@ -#!/bin/sh +#!/bin/bash CURRENT_BRANCH=`git branch --show-current` if [[ $CURRENT_BRANCH != "master" ]]; then echo "Not on master branch" - exit + exit 1 fi VERSION=`ci/version-number.sh ios` @@ -10,20 +10,16 @@ DATE=`date "+%Y-%m-%d"` CHANGELOG_GLOB="Passepartout/App/*/CHANGELOG.md" COMMIT_MESSAGE="[ci skip] 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 +sed -i'' -E "s/^.*Unreleased.*$/## $VERSION ($DATE)/" $CHANGELOG_GLOB if ! git commit -am "$COMMIT_MESSAGE"; then echo "Failed to commit release" git reset --hard - exit + exit 1 fi -if ! git tag $TAG_SIGN -a "v$VERSION" -m "$TAG_MESSAGE"; then +if ! git tag -a "v$VERSION" -m "$TAG_MESSAGE"; then echo "Failed to tag release" git reset --hard HEAD^ - exit + exit 1 fi diff --git a/scripts/commit-beta.sh b/scripts/commit-beta.sh index d722dfe1..1b708ad6 100755 --- a/scripts/commit-beta.sh +++ b/scripts/commit-beta.sh @@ -2,20 +2,17 @@ CURRENT_BRANCH=`git branch --show-current` if [[ $CURRENT_BRANCH != "master" ]]; then echo "Not on master branch" - exit + exit 1 fi -# just in case -scripts/after-beta.sh - # set build number . .env BUILD=$((BASE_BUILD_NUMBER + `git rev-list HEAD --count` + 1)) ci/set-build.sh $BUILD # set release notes -ci/update-changelog.sh ios && - ci/update-changelog.sh mac && +ci/update-release-notes.sh ios && + ci/update-release-notes.sh mac && ci/copy-release-notes.sh ios && ci/copy-release-notes.sh mac @@ -31,6 +28,6 @@ git add *.plist git add Passepartout/App/*/CHANGELOG.md git add Passepartout/App/*/fastlane/metadata/*/release_notes.txt -git commit -m "Set beta release" +git commit -m "Attempt beta release" #VERSION=`ci/version-number.sh ios` #git tag "v$VERSION-b$BUILD" diff --git a/scripts/push-stable.sh b/scripts/push-stable.sh deleted file mode 100755 index 8ae240fa..00000000 --- a/scripts/push-stable.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/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