From f58331512d7494ecca4a404b87112d87c079ac81 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Wed, 10 Jul 2024 07:51:37 -0400 Subject: [PATCH 1/7] Add checkout --- .github/workflows/create-version.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/create-version.yml b/.github/workflows/create-version.yml index ee9238ce71..78de754db2 100644 --- a/.github/workflows/create-version.yml +++ b/.github/workflows/create-version.yml @@ -55,6 +55,8 @@ jobs: needs: [ version_increment_is_bump ] if: ${{ needs.version_increment_is_bump.outputs.isBump == 'true' || inputs.versionIncrementType == 'manual' }} steps: + - name: Checkout code + uses: actions/checkout@v4 - name: Increment Version run: | if [ ${{ needs.version_increment_is_bump.outputs.isBump }} == 'true' ]; then From 53f7a9cc018c0baf7d504d540666910ee3f13d00 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Wed, 10 Jul 2024 07:53:54 -0400 Subject: [PATCH 2/7] Add pod install --- .github/workflows/create-version.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/create-version.yml b/.github/workflows/create-version.yml index 78de754db2..00c394a230 100644 --- a/.github/workflows/create-version.yml +++ b/.github/workflows/create-version.yml @@ -57,6 +57,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + - name: Pod Install + uses: ./.github/actions/pod-install - name: Increment Version run: | if [ ${{ needs.version_increment_is_bump.outputs.isBump }} == 'true' ]; then From 7d8cdd6cb1692abfb4c4f1c201a68c9f8a0d10d5 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Wed, 10 Jul 2024 09:46:29 -0400 Subject: [PATCH 3/7] Try sed to change version --- .github/workflows/create-version.yml | 258 ++++++++++----------------- 1 file changed, 96 insertions(+), 162 deletions(-) diff --git a/.github/workflows/create-version.yml b/.github/workflows/create-version.yml index 00c394a230..032070143b 100644 --- a/.github/workflows/create-version.yml +++ b/.github/workflows/create-version.yml @@ -48,31 +48,10 @@ jobs: else echo echo "value=false" >> "$GITHUB_OUTPUT" fi - - increment_version: - name: Fastlane Increment Version - runs-on: macos-14 - needs: [ version_increment_is_bump ] - if: ${{ needs.version_increment_is_bump.outputs.isBump == 'true' || inputs.versionIncrementType == 'manual' }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Pod Install - uses: ./.github/actions/pod-install - - name: Increment Version - run: | - if [ ${{ needs.version_increment_is_bump.outputs.isBump }} == 'true' ]; then - bundle exec fastlane cru_shared_lane_increment_version_number bump_type:${{ inputs.versionIncrementType }} - elif [ ${{ inputs.versionIncrementType }} == 'manual' ]; then - bundle exec fastlane cru_shared_lane_increment_version_number version_number:${{ inputs.manualVersionNumber }} - else - echo "No Version" - fi - + current_version: name: Store Current Version runs-on: ubuntu-latest - needs: [ increment_version ] if: github.event_name == 'workflow_dispatch' outputs: version: ${{ steps.version.outputs.version }} @@ -93,150 +72,105 @@ jobs: VERSION: ${{ needs.current_version.outputs.version }} run: | printf '%s\n' "$VERSION" - - # current_version: - # name: Store Current Version - # runs-on: ubuntu-latest - # if: github.event_name == 'workflow_dispatch' - # outputs: - # version: ${{ steps.version.outputs.version }} - # steps: - # - name: Checkout code - # uses: actions/checkout@v4 - # - name: Set Version Output - # id: version - # run: grep s\\.version\\s OAuth.podspec | sed 's/s.//' | sed "s/'//g" | sed 's/ //g' >> $GITHUB_OUTPUT - # print_current_version: - # name: Print Current Version - # runs-on: ubuntu-latest - # needs: [ current_version ] - # steps: - # - name: Print Current Version - # env: - # VERSION: ${{ needs.current_version.outputs.version }} - # run: | - # printf '%s\n' "$VERSION" - - # bump_version: - # name: Store Bump Version - # runs-on: ubuntu-latest - # outputs: - # version: ${{ steps.version.outputs.version }} - # needs: [ current_version, version_increment_is_bump ] - # steps: - # - name: Bump Version - # if: ${{ needs.version_increment_is_bump.outputs.isBump == 'true' }} - # id: bump-semver - # uses: actions-ecosystem/action-bump-semver@v1 - # with: - # current_version: ${{ needs.current_version.outputs.version }} - # level: ${{ inputs.versionIncrementType }} - # - name: Store Bump Version - # id: version - # run: | - # echo "version=${{ steps.bump-semver.outputs.new_version }}" >> $GITHUB_OUTPUT + bump_version: + name: Store Bump Version + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + needs: [ current_version, version_increment_is_bump ] + steps: + - name: Bump Version + if: ${{ needs.version_increment_is_bump.outputs.isBump == 'true' }} + id: bump-semver + uses: actions-ecosystem/action-bump-semver@v1 + with: + current_version: ${{ needs.current_version.outputs.version }} + level: ${{ inputs.versionIncrementType }} + - name: Store Bump Version + id: version + run: | + echo "version=${{ steps.bump-semver.outputs.new_version }}" >> $GITHUB_OUTPUT - # print_bump_version: - # name: Print Bump Version - # runs-on: ubuntu-latest - # needs: [ bump_version, version_increment_is_bump ] - # if: ${{ needs.version_increment_is_bump.outputs.isBump == 'true' }} - # steps: - # - name: Print Bump Version - # env: - # VERSION: ${{ needs.bump_version.outputs.version }} - # run: | - # printf '%s\n' "$VERSION" + print_bump_version: + name: Print Bump Version + runs-on: ubuntu-latest + needs: [ bump_version, version_increment_is_bump ] + if: ${{ needs.version_increment_is_bump.outputs.isBump == 'true' }} + steps: + - name: Print Bump Version + env: + VERSION: ${{ needs.bump_version.outputs.version }} + run: | + printf '%s\n' "$VERSION" - # manual_version: - # name: Store Manual Version - # runs-on: ubuntu-latest - # outputs: - # version: ${{ steps.version.outputs.version }} - # if: inputs.versionIncrementType == 'manual' - # steps: - # - name: Store Manual Version - # id: version - # run: | - # echo "version=${{ inputs.manualVersionNumber }}" >> $GITHUB_OUTPUT + manual_version: + name: Store Manual Version + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + if: inputs.versionIncrementType == 'manual' + steps: + - name: Store Manual Version + id: version + run: | + echo "version=${{ inputs.manualVersionNumber }}" >> $GITHUB_OUTPUT - # print_manual_version: - # name: Print Manual Version - # runs-on: ubuntu-latest - # needs: [ manual_version ] - # if: inputs.versionIncrementType == 'manual' - # steps: - # - name: Print Manual Version - # env: - # VERSION: ${{ needs.manual_version.outputs.version }} - # run: | - # printf '%s\n' "$VERSION" + print_manual_version: + name: Print Manual Version + runs-on: ubuntu-latest + needs: [ manual_version ] + if: inputs.versionIncrementType == 'manual' + steps: + - name: Print Manual Version + env: + VERSION: ${{ needs.manual_version.outputs.version }} + run: | + printf '%s\n' "$VERSION" - # new_version: - # name: Store New Version - # runs-on: ubuntu-latest - # needs: [ version_increment_is_bump, bump_version ] - # if: ${{ needs.version_increment_is_bump.outputs.isBump == 'true' || inputs.versionIncrementType == 'manual' }} - # outputs: - # version: ${{ steps.version.outputs.version }} - # steps: - # - name: Store New Version - # id: version - # run: | - # if [ ${{ needs.version_increment_is_bump.outputs.isBump }} == 'true' ]; then - # echo "version=${{ needs.bump_version.outputs.version }}" >> $GITHUB_OUTPUT - # elif [ ${{ inputs.versionIncrementType }} == 'manual' ]; then - # echo "version=${{ inputs.manualVersionNumber }}" >> $GITHUB_OUTPUT - # else - # echo "No Version" - # fi - - # print_new_version: - # name: Print New Version - # runs-on: ubuntu-latest - # needs: [ new_version ] - # steps: - # - name: Print New Version - # env: - # VERSION: ${{ needs.new_version.outputs.version }} - # run: | - # printf '%s\n' "$VERSION" - - # create_version_branch_and_pull_request: - # name: Create Version Branch and PR - # runs-on: ubuntu-latest - # needs: [ current_version, new_version ] - # steps: - # - name: Checkout code - # uses: actions/checkout@v4 - # - name: Set Podspec Version to New Version - # run: | - # sed -i "s/s.version = '${{ needs.current_version.outputs.version }}'/s.version = '${{ needs.new_version.outputs.version }}'/g" OAuth.podspec - # - name: Create Version Branch and PR - # uses: peter-evans/create-pull-request@v6 - # with: - # branch: "versions/${{ needs.new_version.outputs.version }}" - # title: "Version ${{needs.new_version.outputs.version}}" - # commit-message: "Increase version to ${{needs.new_version.outputs.version}}" - - - + new_version: + name: Store New Version + runs-on: ubuntu-latest + needs: [ version_increment_is_bump, bump_version ] + if: ${{ needs.version_increment_is_bump.outputs.isBump == 'true' || inputs.versionIncrementType == 'manual' }} + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Store New Version + id: version + run: | + if [ ${{ needs.version_increment_is_bump.outputs.isBump }} == 'true' ]; then + echo "version=${{ needs.bump_version.outputs.version }}" >> $GITHUB_OUTPUT + elif [ ${{ inputs.versionIncrementType }} == 'manual' ]; then + echo "version=${{ inputs.manualVersionNumber }}" >> $GITHUB_OUTPUT + else + echo "No Version" + fi - # fastlane_bump_version: - # name: Fastlane Bump Version - # runs-on: macos-14 - # needs: [ version_increment_is_bump ] - # if: ${{ needs.version_increment_is_bump.outputs.isBump == 'true' }} - # steps: - # - name: Run Fastlane Bump Version - # run: bundle exec fastlane cru_shared_lane_increment_version_number bump_type:${{ inputs.versionIncrementType }} + print_new_version: + name: Print New Version + runs-on: ubuntu-latest + needs: [ new_version ] + steps: + - name: Print New Version + env: + VERSION: ${{ needs.new_version.outputs.version }} + run: | + printf '%s\n' "$VERSION" - # fastlane_set_version: - # name: Fastlane Set Version - # runs-on: macos-14 - # needs: [ version_increment_is_bump ] - # if: ${{ needs.version_increment_is_bump.outputs.isBump == 'false' }} - # steps: - # - name: Run Fastlane Set Version - # run: bundle exec fastlane cru_shared_lane_increment_version_number version_number:${{ inputs.manualVersionNumber }} + create_version_branch_and_pull_request: + name: Create Version Branch and PR + runs-on: ubuntu-latest + needs: [ current_version, new_version ] + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set Podspec Version to New Version + run: | + sed -i "s/MARKETING_VERSION = ${{ needs.current_version.outputs.version }}/MARKETING_VERSION = ${{ needs.new_version.outputs.version }}/g" godtools.xcodeproj/project.pbxproj + - name: Create Version Branch and PR + uses: peter-evans/create-pull-request@v6 + with: + branch: "versions/${{ needs.new_version.outputs.version }}" + title: "Version ${{needs.new_version.outputs.version}}" + commit-message: "Increase version to ${{needs.new_version.outputs.version}}" \ No newline at end of file From 9aa2996220c6c436cc231a5fe601239348265de0 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Wed, 10 Jul 2024 10:00:59 -0400 Subject: [PATCH 4/7] Update grep for current version --- .github/workflows/create-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-version.yml b/.github/workflows/create-version.yml index 032070143b..a138ebe956 100644 --- a/.github/workflows/create-version.yml +++ b/.github/workflows/create-version.yml @@ -60,7 +60,7 @@ jobs: uses: actions/checkout@v4 - name: Set Version Output id: version - run: grep -m 1 MARKETING_VERSION godtools.xcodeproj/project.pbxproj | sed 's/s.//' | sed "s/'//g" | sed 's/ //g' | sed 's/;//g' | sed 's/MARKETING_VERSION=//g' >> $GITHUB_OUTPUT + run: grep s\\MARKETING_VERSION\\s godtools.xcodeproj/project.pbxproj | sed 's/MARKETING_VERSION//' | sed "s/'//g" | sed 's/ //g' >> $GITHUB_OUTPUT print_current_version: name: Print Current Version From 6a8e414ee2f23be2190b69b209b69834d48f3636 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Wed, 10 Jul 2024 10:04:29 -0400 Subject: [PATCH 5/7] Stop at first match --- .github/workflows/create-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-version.yml b/.github/workflows/create-version.yml index a138ebe956..9f5a70f579 100644 --- a/.github/workflows/create-version.yml +++ b/.github/workflows/create-version.yml @@ -60,7 +60,7 @@ jobs: uses: actions/checkout@v4 - name: Set Version Output id: version - run: grep s\\MARKETING_VERSION\\s godtools.xcodeproj/project.pbxproj | sed 's/MARKETING_VERSION//' | sed "s/'//g" | sed 's/ //g' >> $GITHUB_OUTPUT + run: grep -m 1 s\\MARKETING_VERSION\\s godtools.xcodeproj/project.pbxproj | sed 's/MARKETING_VERSION//' | sed "s/'//g" | sed 's/ //g' >> $GITHUB_OUTPUT print_current_version: name: Print Current Version From 8b566e7bb22e084c451ca8e182d225d403bf0796 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Wed, 10 Jul 2024 11:53:14 -0400 Subject: [PATCH 6/7] Add version= --- .github/workflows/create-version.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-version.yml b/.github/workflows/create-version.yml index 9f5a70f579..047477937a 100644 --- a/.github/workflows/create-version.yml +++ b/.github/workflows/create-version.yml @@ -60,7 +60,8 @@ jobs: uses: actions/checkout@v4 - name: Set Version Output id: version - run: grep -m 1 s\\MARKETING_VERSION\\s godtools.xcodeproj/project.pbxproj | sed 's/MARKETING_VERSION//' | sed "s/'//g" | sed 's/ //g' >> $GITHUB_OUTPUT + run: | + eval "echo version=$(grep -m 1 s\\MARKETING_VERSION\\s godtools.xcodeproj/project.pbxproj | sed 's/MARKETING_VERSION//' | sed "s/'//g" | sed 's/ //g' | sed 's/;//g')" >> $GITHUB_OUTPUT print_current_version: name: Print Current Version From 074be77690e98795bbee178050724ce2fe064cfb Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Wed, 10 Jul 2024 12:14:37 -0400 Subject: [PATCH 7/7] echo version --- .github/workflows/create-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-version.yml b/.github/workflows/create-version.yml index 047477937a..d4bb0aa79a 100644 --- a/.github/workflows/create-version.yml +++ b/.github/workflows/create-version.yml @@ -61,7 +61,7 @@ jobs: - name: Set Version Output id: version run: | - eval "echo version=$(grep -m 1 s\\MARKETING_VERSION\\s godtools.xcodeproj/project.pbxproj | sed 's/MARKETING_VERSION//' | sed "s/'//g" | sed 's/ //g' | sed 's/;//g')" >> $GITHUB_OUTPUT + echo "version=$(grep -m 1 MARKETING_VERSION godtools.xcodeproj/project.pbxproj | sed 's/;//g' | sed 's/ //g' | sed 's/=//g' | sed 's/MARKETING_VERSION//g')" >> $GITHUB_OUTPUT print_current_version: name: Print Current Version