-
Notifications
You must be signed in to change notification settings - Fork 8
153 lines (143 loc) · 5.49 KB
/
release.yml
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: New Release on Tag Push
on:
push:
tags:
- '*.*.*'
env:
LAST_TAG_NAME: ""
LAST_TAG_MESSAGE: ""
jobs:
get_tag_info:
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.get_tag_name.outputs.tag_name }} }}
tag_message: ${{ steps.get_tag_message.outputs.tag_message }}
steps:
- name: Add Git Identity
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Print tag
run: |
git show -s --format=%s 0.1.3
- name: Get last tag name
id: get_tag_name
run: echo "tag_name=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
- name: Get last tag message
id: get_tag_message
run: |
echo "tag_message=$(git tag -l ${{ steps.get_tag_name.outputs.tag_name }} --format='%(contents)')" >> $GITHUB_OUTPUT
- name: Print Outputs
run: |
echo "Tag Name: ${{ steps.get_tag_name.outputs.tag_name }}"
echo "Tag Message: ${{ steps.get_tag_message.outputs.tag_message }}"
echo "tag_message=$(git tag -l 0.1.3 --format='%(contents)')"
# run_copy_script:
# runs-on: macos-latest
# needs: get_tag_info
# permissions:
# contents: write
# outputs:
# changes_made: ${{ steps.check_changes.outputs.changes_made }}
# working_branch: ${{ steps.check_changes.outputs.working_branch }}
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Run copy script
# run: |
# python3 code_gen/code_gen.py Sources
# - name: Reindent Code
# run: |
# brew install mint
# mint install apple/swift-format@release/5.7
# mint run apple/swift-format@release/5.7 -i -r Sources/iOS-BLE-Library-Mock --configuration format.swift-format
# - name: Check for Changes
# id: check_changes
# run: |
# if [ -n "$(git status --porcelain)" ]; then
# echo "changes_made=true" >> $GITHUB_OUTPUT
# # echo "working_branch=release/${{ needs.get_tag_info.outputs.tag_name }}" >> $GITHUB_OUTPUT
# echo "working_branch=main" >> $GITHUB_OUTPUT
# else
# echo "changes_made=false" >> $GITHUB_OUTPUT
# echo "working_branch=main" >> $GITHUB_OUTPUT
# fi
# - name: Add & Commit
# if: steps.check_changes.outputs.changes_made == 'true'
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# commit_message: 'Copied files from native CoreBluetooth version to CoreBluetoothMock'
# branch: ${{ steps.check_changes.outputs.working_branch }}
# - name: Move Tag
# if: steps.check_changes.outputs.changes_made == 'true'
# run: |
# git tag -d ${{ needs.get_tag_info.outputs.tag_name }}
# git push origin :refs/tags/${{ needs.get_tag_info.outputs.tag_name }}
# git tag -a ${{ needs.get_tag_info.outputs.tag_name }} -m "${{ needs.get_tag_info.outputs.tag_message }}"
# git push origin ${{ needs.get_tag_info.outputs.tag_name }}
# build_and_test:
# runs-on: macos-latest
# needs: [run_copy_script]
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v4
# - name: Print Xcode Version
# run: xcodebuild -version
# - uses: swift-actions/setup-swift@v1
# - name: Get swift version
# run: swift --version # Swift 5.8.1
# - name: Print Swift Version
# run: xcrun swift -version
# - name: Build Native
# run: swift build --target iOS-BLE-Library --force-resolved-versions
# - name: Build Mock
# run: swift build --target iOS-BLE-Library-Mock --force-resolved-versions
# # Tests temporarily disabled
# # - name: Test
# # run: swift test -v --skip-build
# pod_release:
# needs: [get_tag_info, build_and_test, run_copy_script]
# runs-on: macos-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# ref: ${{ needs.run_copy_script.outputs.working_branch }}
# - name: Setup Ruby
# uses: ruby/setup-ruby@v1
# with:
# ruby-version: 2.7
# - name: Install CocoaPods
# run: gem install cocoapods
# - name: Deploy IOS-BLE-Library to Cocoapods
# run: |
# pod lib lint IOS-BLE-Library.podspec --allow-warnings
# pod trunk push IOS-BLE-Library.podspec --allow-warnings
# env:
# COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
# LIB_VERSION: ${{ needs.get_tag_info.outputs.tag_name }}
# - name: Deploy IOS-BLE-Library-Mock to Cocoapods
# run: |
# pod lib lint IOS-BLE-Library-Mock.podspec --allow-warnings
# pod trunk push IOS-BLE-Library-Mock.podspec --allow-warnings
# env:
# COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
# LIB_VERSION: ${{ needs.get_tag_info.outputs.tag_name }}
# create_release:
# permissions:
# contents: write
# needs: [get_tag_info, pod_release]
# runs-on: ubuntu-latest
# steps:
# - name: Create Release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ needs.get_tag_info.outputs.tag_name }}
# release_name: Release ${{ needs.get_tag_info.outputs.tag_name }}
# body: ${{ needs.get_tag_info.outputs.tag_message }}