Skip to content

Commit d248d4f

Browse files
RMET-3586 ::: Fix Pipeline to Publish on CocoaPods (#20)
* fix: add release pipelines Replace the `release_pod` GitHub Action with the two steps already in use for InAppBrowser: `prepare_release` and `release_and_publish`. This also involves fixing the scripts used. Add the current project and pod values, so that the new version can use it accordingly. Add missing information to the `podspec`. Update `README.md` so that it mentions the pod approach. References: https://outsystemsrd.atlassian.net/browse/RMET-3586 * chore: add CHANGELOG entry References: https://outsystemsrd.atlassian.net/browse/RMET-3586 * chore: add missing Gemfile.lock
1 parent 08b9110 commit d248d4f

File tree

12 files changed

+587
-175
lines changed

12 files changed

+587
-175
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Prepare Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
versionBumpLevel:
7+
description: 'Version bump level (patch, minor, major)'
8+
required: true
9+
type: choice
10+
default: 'patch'
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
16+
jobs:
17+
build-and-release:
18+
if: github.ref == 'refs/heads/main'
19+
runs-on: macos-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Link SwiftLint or install it
25+
run: brew link --overwrite swiftlint || brew install swiftlint
26+
27+
- name: Set up XCode
28+
run: sudo xcode-select --switch /Applications/Xcode_15.0.app
29+
30+
- name: Set up Ruby
31+
uses: ruby/setup-ruby@v1
32+
with:
33+
ruby-version: '3.3'
34+
35+
- name: Bump version
36+
run: ruby ./scripts/bump_versions.rb ${{ github.event.inputs.versionBumpLevel }}
37+
38+
- name: Build XCFramework
39+
run: ./scripts/build_framework.sh
40+
41+
- name: Get new version
42+
id: version
43+
run: echo "VERSION=$(ruby -e 'puts File.read("./OSBarcodeLib.podspec").match(/spec.version.*=.*''(\d+\.\d+\.\d+)''/)[1]')" >> $GITHUB_ENV
44+
45+
- name: Create new branch
46+
run: |
47+
git switch --create "prepare-new-release-${{ env.VERSION }}"
48+
49+
- name: Move zip file to root and push changes
50+
run: |
51+
if [ -f OSBarcodeLib.zip ]; then
52+
rm OSBarcodeLib.zip
53+
else
54+
echo "File does not exist."
55+
fi
56+
mv build/OSBarcodeLib.zip .
57+
git config --global user.name 'github-actions[bot]'
58+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
59+
git add .
60+
git commit -m "chore: Bump version to ${{ env.VERSION }}"
61+
git push origin HEAD:prepare-new-release-${{ env.VERSION }}
62+
63+
- name: Create pull request
64+
id: create_pr
65+
run: |
66+
gh pr create -B main -H prepare-new-release-${{ env.VERSION }} --title 'Prepare `main` to Release `${{ env.VERSION }}`' --body 'Bumps version to `${{ env.VERSION }}`.<br/>Creates an updated and ready-to-be-released `OSInAppBrowserLib.zip`.'
67+
PR_NUMBER=$(gh pr view --json number --jq '.number')
68+
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_ENV
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
72+
- name: Add label to the pull request
73+
run: |
74+
gh api \
75+
--method POST \
76+
-H "Accept: application/vnd.github+json" \
77+
-H "X-GitHub-Api-Version: 2022-11-28" \
78+
/repos/${{ github.repository }}/issues/${{ env.PR_NUMBER }}/labels \
79+
-f "labels[]=release"
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release and Publish
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- 'main'
8+
9+
jobs:
10+
post-merge:
11+
if: contains(github.event.pull_request.labels.*.name, 'release')
12+
runs-on: macos-latest
13+
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Cocoapods
19+
run: gem install cocoapods
20+
21+
- name: Get new version
22+
id: version
23+
run: echo "VERSION=$(ruby -e 'puts File.read("./OSBarcodeLib.podspec").match(/spec.version.*=.*''(\d+\.\d+\.\d+)''/)[1]')" >> $GITHUB_ENV
24+
25+
- name: Extract release notes
26+
run: sh scripts/extract_release_notes.sh "${{ env.VERSION }}" >> release_notes.md
27+
28+
- name: Create Tag
29+
id: create_tag
30+
run: |
31+
# Define the tag name and message
32+
TAG_NAME="${{ env.VERSION }}"
33+
TAG_MESSAGE="Tag for version ${{ env.VERSION }}"
34+
35+
# Create the tag
36+
git tag -a "$TAG_NAME" -m "$TAG_MESSAGE"
37+
git push origin "$TAG_NAME"
38+
39+
echo "Tag created: $TAG_NAME"
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Create Release
44+
run: |
45+
# Extract the tag name
46+
TAG_NAME="${{ env.VERSION }}"
47+
RELEASE_NOTES="$(cat release_notes.md)"
48+
49+
# Create the release using GitHub CLI
50+
gh release create "$TAG_NAME" \
51+
--title "$TAG_NAME" \
52+
--notes "$RELEASE_NOTES" \
53+
"OSBarcodeLib.zip"
54+
55+
echo "Release created for tag: $TAG_NAME"
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: Deploy to Cocoapods
60+
run: pod trunk push ./OSBarcodeLib.podspec --allow-warnings
61+
env:
62+
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
63+
64+
- name: Delete Release Branch
65+
run: git push origin --delete prepare-new-release-${{ env.VERSION }}
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release_pod.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88

99
### Fixes
10+
- Fix pod publish pipeline (https://outsystemsrd.atlassian.net/browse/RMET-3586).
1011
- Fix upside down video capture stream (https://outsystemsrd.atlassian.net/browse/RMET-3585).
1112

1213
## 1.1.0

0 commit comments

Comments
 (0)