|
| 1 | +on: |
| 2 | + push: |
| 3 | + branches: [ master ] |
| 4 | + |
| 5 | +jobs: |
| 6 | + check-release-tag: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + steps: |
| 9 | + - name: Checkout code |
| 10 | + uses: actions/checkout@v2 |
| 11 | + with: |
| 12 | + fetch-depth: 0 |
| 13 | + - uses: actions/setup-node@v3 |
| 14 | + - name: Prepare tag |
| 15 | + id: prepare_tag |
| 16 | + continue-on-error: true |
| 17 | + run: | |
| 18 | + npm install --location=global podspec-bump |
| 19 | + export TAG=$(podspec-bump --dump-version -p PusherSwift.podspec) |
| 20 | + echo "TAG=$TAG" >> $GITHUB_ENV |
| 21 | + export CHECK_TAG=$(git tag | grep $TAG) |
| 22 | + if [[ $CHECK_TAG ]]; then |
| 23 | + echo "Skipping because release tag already exists" |
| 24 | + exit 1 |
| 25 | + fi |
| 26 | + - name: Output |
| 27 | + id: release_output |
| 28 | + if: ${{ steps.prepare_tag.outcome == 'success' }} |
| 29 | + run: | |
| 30 | + echo "::set-output name=tag::${{ env.TAG }}" |
| 31 | + outputs: |
| 32 | + tag: ${{ steps.release_output.outputs.tag }} |
| 33 | + |
| 34 | + build: |
| 35 | + runs-on: macos-latest |
| 36 | + needs: check-release-tag |
| 37 | + if: ${{ needs.check-release-tag.outputs.tag }} |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v2 |
| 40 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 41 | + with: |
| 42 | + xcode-version: '13.2.1' |
| 43 | + - name: build |
| 44 | + run: | |
| 45 | + sh ./Consumption-Tests/Shared/carthage.sh bootstrap --use-xcframeworks |
| 46 | + set -o pipefail && env NSUnbufferedIO=YES xcodebuild \ |
| 47 | + -project PusherSwift.xcodeproj \ |
| 48 | + -scheme PusherSwift \ |
| 49 | + build \ |
| 50 | + | xcpretty --color |
| 51 | +
|
| 52 | + publish-cocoapods: |
| 53 | + runs-on: ubuntu-latest |
| 54 | + needs: build |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v2 |
| 57 | + - uses: ruby/setup-ruby@v1 |
| 58 | + with: |
| 59 | + ruby-version: '2.6' |
| 60 | + - run: | |
| 61 | + gem install cocoapods |
| 62 | + pod trunk push PusherSwift.podspec |
| 63 | + pod trunk push PusherSwiftWithEncryption.podspec |
| 64 | + env: |
| 65 | + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TOKEN }} |
| 66 | +
|
| 67 | + create-github-release: |
| 68 | + runs-on: ubuntu-latest |
| 69 | + needs: publish-cocoapods |
| 70 | + if: ${{ needs.check-release-tag.outputs.tag }} |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v2 |
| 73 | + - name: Prepare tag |
| 74 | + run: | |
| 75 | + export TAG=${{ needs.check-release-tag.outputs.tag }} |
| 76 | + echo "TAG=$TAG" >> $GITHUB_ENV |
| 77 | + - name: Setup git |
| 78 | + run: | |
| 79 | + git config user.email "pusher-ci@pusher.com" |
| 80 | + git config user.name "Pusher CI" |
| 81 | + - name: Create Release |
| 82 | + uses: actions/create-release@v1 |
| 83 | + env: |
| 84 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 85 | + with: |
| 86 | + tag_name: ${{ env.TAG }} |
| 87 | + release_name: ${{ env.TAG }} |
| 88 | + draft: false |
| 89 | + prerelease: false |
| 90 | + |
| 91 | + |
0 commit comments