-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (87 loc) · 3.78 KB
/
shared-publish-to-ios-version.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Shared Pipeline to build and publish iOS packages
on:
workflow_call:
inputs:
release_type:
description: The type of version number to return. Must be one of [Patch, Minor or Major]
required: true
type: string
working_dir:
description: The path to the directory for which the version should be determined.
type: string
default: '.'
env:
REPO: ${{ github.event.repository.name }}
jobs:
release:
name: Create Release
runs-on: macos-latest
permissions:
pull-requests: write
contents: write
security-events: write
packages: write
steps:
- name: Show Context
run: |
printenv
echo "$GITHUB_CONTEXT"
shell: bash
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Check branch and release type
id: checkRelease
uses: IABTechLab/uid2-shared-actions/actions/check_branch_and_release_type@v2
with:
release_type: ${{ inputs.release_type }}
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set version number
id: version
uses: IABTechLab/uid2-shared-actions/actions/version_number@v2
with:
type: ${{ inputs.release_type }}
branch_name: ${{ github.ref }}
working_dir: ${{ inputs.working_dir }}
- name: Lint code
run: swiftlint lint --config .swiftlint.yml --reporter github-actions-logging
- name: Update UID2.Client.ios
run: |
current_version=$(grep -o '<string>.*</string>' ${{ inputs.working_dir }}/Sources/UID2/Properties/sdk_properties.plist | head -1 | sed 's/<string>\(.*\)<\/string>/\1/')
new_version=${{ steps.version.outputs.new_version }}
sed -i '' -e "s/$current_version/$new_version/g" ${{ inputs.working_dir }}/Sources/UID2/Properties/sdk_properties.plist
echo "Version number updated from $current_version to $new_version"
- name: Build, Test
run: |
cd ./${{ inputs.working_dir }}
xcodebuild -scheme UID2 -sdk iphonesimulator16.2 -destination "OS=16.2,name=iPhone 14"
xcodebuild test -scheme UID2Tests -sdk iphonesimulator16.2 -destination "OS=16.2,name=iPhone 14"
- name: Commit sdk_properties, version.json and set tag
uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@v2
with:
add: '${{ inputs.working_dir }}/Sources/UID2/Properties/sdk_properties.plist ${{ inputs.working_dir }}/version.json'
message: 'Released ${{ inputs.release_type }} version: ${{ steps.version.outputs.new_version }}'
tag: v${{ steps.version.outputs.new_version }}
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v4
with:
toTag: v${{ steps.version.outputs.new_version }}
configurationJson: |
{
"template": "#{{CHANGELOG}}\n## NuGet\n```\n<dependency>\n <groupId>com.uid2</groupId>\n <artifactId>${{ env.REPO }}</artifactId>\n <version>${{ steps.version.outputs.new_version }}</version>\n</dependency>\n```\n\n## Nuget Files\n- [UID2.Client.${{ steps.version.outputs.new_version }}.nupkg](https://www.nuget.org/packages/UID2.Client)\n\n## Changelog\n#{{UNCATEGORIZED}}",
"pr_template": " - #{{TITLE}} - ( PR: ##{{NUMBER}} )"
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Zip and Tar repo
run:
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: v${{ steps.version.outputs.new_version }}
body: ${{ steps.github_release.outputs.changelog }}
draft: true
files: |