From 12af8b4a71db5989d9e303d4221ef7b1a2111eea Mon Sep 17 00:00:00 2001 From: Shahroz Khan Date: Sun, 26 May 2024 09:49:28 -0400 Subject: [PATCH 1/7] added workflow (#6) --- .github/workflows/tag-and-release.yml | 46 +++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/tag-and-release.yml diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml new file mode 100644 index 0000000..8a62b48 --- /dev/null +++ b/.github/workflows/tag-and-release.yml @@ -0,0 +1,46 @@ +name: Release with Tag + +on: + workflow_dispatch: + inputs: + tag: + description: 'Tag to create and deploy' + required: true + +permissions: + contents: write + +jobs: + create-tag: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.0 + - name: Install fastlane + run: gem install fastlane + + - name: Create and push tag + uses: rickstaa/action-create-tag@v1 + id: tag_create + with: + tag: ${{ github.event.inputs.tag }} + + - name: Bump version in podspec + run: | + fastlane run version_bump_podspec path:"AnalyticsSwiftCIO.podspec" version_number:"${{ github.event.inputs.tag }}" + + - name: Commit and push podspec + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "Bump podspec version to ${{ github.event.inputs.tag }}" + file_pattern: AnalyticsSwiftCIO.podspec + + - name: Deploy to cocoapoads + env: + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} + run: | + pod trunk push AnalyticsSwiftCIO.podspec --allow-warnings \ No newline at end of file From 68446c511a8f8b6292fd1a44ee76023089c44c5a Mon Sep 17 00:00:00 2001 From: Shahroz Khan Date: Sun, 26 May 2024 10:29:46 -0400 Subject: [PATCH 2/7] Manual update script --- .github/workflows/tag-and-release.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index 8a62b48..613ce4f 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -16,12 +16,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.0 - - name: Install fastlane - run: gem install fastlane - name: Create and push tag uses: rickstaa/action-create-tag@v1 @@ -29,9 +23,11 @@ jobs: with: tag: ${{ github.event.inputs.tag }} - - name: Bump version in podspec + - name: Manually update version and tag in podspec run: | - fastlane run version_bump_podspec path:"AnalyticsSwiftCIO.podspec" version_number:"${{ github.event.inputs.tag }}" + sed -i.bak 's/s.version *= *"[^"]*"/s.version = "${{ github.event.inputs.tag }}"/' AnalyticsSwiftCIO.podspec + sed -i.bak 's/:tag => *"[^"]*"/:tag => "${{ github.event.inputs.tag }}"/' AnalyticsSwiftCIO.podspec + rm AnalyticsSwiftCIO.podspec.bak - name: Commit and push podspec uses: stefanzweifel/git-auto-commit-action@v4 From 5a818454dc47556b62606999b01a96ae4169eb91 Mon Sep 17 00:00:00 2001 From: Shahroz16 Date: Sun, 26 May 2024 14:30:35 +0000 Subject: [PATCH 3/7] Bump podspec version to 1.5.12+cio.2 --- AnalyticsSwiftCIO.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AnalyticsSwiftCIO.podspec b/AnalyticsSwiftCIO.podspec index 85ce39f..8631650 100644 --- a/AnalyticsSwiftCIO.podspec +++ b/AnalyticsSwiftCIO.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "AnalyticsSwiftCIO" - s.version = "1.5.12+cio.1" + s.version = "1.5.12+cio.2" s.license = { :type => 'MIT', :file => './LICENSE' } s.summary = "Customer.io Data Pipelines analytics client for Swift app (iOS/tvOS/watchOS/macOS/Linux)." s.homepage = "https://github.com/customerio/cdp-analytics-swift" From b475c569e1cd2199ff0d450008d470e7c2a76b8f Mon Sep 17 00:00:00 2001 From: Shahroz Khan Date: Sun, 26 May 2024 10:42:02 -0400 Subject: [PATCH 4/7] fix script --- .github/workflows/tag-and-release.yml | 11 +++++++++-- AnalyticsSwiftCIO.podspec | 7 +++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index 613ce4f..c59ec5b 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -17,6 +17,14 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.0 + + - name: Install CocoaPods + run: gem install cocoapods + - name: Create and push tag uses: rickstaa/action-create-tag@v1 id: tag_create @@ -25,8 +33,7 @@ jobs: - name: Manually update version and tag in podspec run: | - sed -i.bak 's/s.version *= *"[^"]*"/s.version = "${{ github.event.inputs.tag }}"/' AnalyticsSwiftCIO.podspec - sed -i.bak 's/:tag => *"[^"]*"/:tag => "${{ github.event.inputs.tag }}"/' AnalyticsSwiftCIO.podspec + sed -i.bak 's/\(version = \)"[^"]*"/\1"${{ github.event.inputs.tag }}"/' AnalyticsSwiftCIO.podspec rm AnalyticsSwiftCIO.podspec.bak - name: Commit and push podspec diff --git a/AnalyticsSwiftCIO.podspec b/AnalyticsSwiftCIO.podspec index 8631650..2442426 100644 --- a/AnalyticsSwiftCIO.podspec +++ b/AnalyticsSwiftCIO.podspec @@ -1,6 +1,9 @@ Pod::Spec.new do |s| + + version = "1.5.12+cio.1" # Define your version variable here + s.name = "AnalyticsSwiftCIO" - s.version = "1.5.12+cio.2" + s.version = version s.license = { :type => 'MIT', :file => './LICENSE' } s.summary = "Customer.io Data Pipelines analytics client for Swift app (iOS/tvOS/watchOS/macOS/Linux)." s.homepage = "https://github.com/customerio/cdp-analytics-swift" @@ -8,7 +11,7 @@ Pod::Spec.new do |s| # Make sure the tag is the same as what SPM customers are using. # update branch to version - s.source = { :git => 'https://github.com/customerio/cdp-analytics-swift.git', :tag => '1.5.12+cio.1' } + s.source = { :git => 'https://github.com/customerio/cdp-analytics-swift.git', :tag => version } s.ios.deployment_target = "13.0" s.requires_arc = true From 4289323ea77115af47239f4ebeeb4e738aa0f95c Mon Sep 17 00:00:00 2001 From: Shahroz Khan Date: Sun, 26 May 2024 10:56:46 -0400 Subject: [PATCH 5/7] create release with change log --- .github/workflows/tag-and-release.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index c59ec5b..021d669 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -16,6 +16,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags - name: Setup Ruby uses: ruby/setup-ruby@v1 @@ -25,12 +27,23 @@ jobs: - name: Install CocoaPods run: gem install cocoapods - - name: Create and push tag - uses: rickstaa/action-create-tag@v1 - id: tag_create + - name: Get current version + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + + - name: Create GitHub Release + uses: actions/create-release@v1 + id: create_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag: ${{ github.event.inputs.tag }} - + tag_name: ${{ github.event.inputs.tag }} + release_name: Release ${{ github.event.inputs.tag }} + draft: false + prerelease: false + body: | + Changes since [${{ steps.previoustag.outputs.tag }}](https://github.com/${{ github.repository }}/compare/${{ steps.previoustag.outputs.tag }}...${{ github.event.inputs.tag }}) + - name: Manually update version and tag in podspec run: | sed -i.bak 's/\(version = \)"[^"]*"/\1"${{ github.event.inputs.tag }}"/' AnalyticsSwiftCIO.podspec From af34b5dc1d70d5170af5286541a5fc8cf0fa7aee Mon Sep 17 00:00:00 2001 From: Shahroz16 Date: Sun, 26 May 2024 14:58:18 +0000 Subject: [PATCH 6/7] Bump podspec version to 1.5.12+cio.3 --- AnalyticsSwiftCIO.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AnalyticsSwiftCIO.podspec b/AnalyticsSwiftCIO.podspec index 2442426..2270ab7 100644 --- a/AnalyticsSwiftCIO.podspec +++ b/AnalyticsSwiftCIO.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| - version = "1.5.12+cio.1" # Define your version variable here + version = "1.5.12+cio.3" # Define your version variable here s.name = "AnalyticsSwiftCIO" s.version = version From 1b2dce195d29b5882864b947f05bae525b64d9d8 Mon Sep 17 00:00:00 2001 From: Shahroz Khan Date: Sun, 26 May 2024 11:03:24 -0400 Subject: [PATCH 7/7] cleanup --- .github/workflows/tag-and-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tag-and-release.yml b/.github/workflows/tag-and-release.yml index 021d669..8569de8 100644 --- a/.github/workflows/tag-and-release.yml +++ b/.github/workflows/tag-and-release.yml @@ -38,12 +38,12 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.event.inputs.tag }} - release_name: Release ${{ github.event.inputs.tag }} + release_name: ${{ github.event.inputs.tag }} draft: false prerelease: false body: | Changes since [${{ steps.previoustag.outputs.tag }}](https://github.com/${{ github.repository }}/compare/${{ steps.previoustag.outputs.tag }}...${{ github.event.inputs.tag }}) - + - name: Manually update version and tag in podspec run: | sed -i.bak 's/\(version = \)"[^"]*"/\1"${{ github.event.inputs.tag }}"/' AnalyticsSwiftCIO.podspec