Skip to content

Commit

Permalink
Unify Release and CI workflows 🤝 (#236)
Browse files Browse the repository at this point in the history
Unfortunately, `workflow_run` triggers only capture the branch that
triggered the workflow(s) they depend on, which means that we can't use
them while filtering for tag pushes (which is what we want for
triggering releases). That's why `startsWith(github.ref, 'refs/tags/')`
was never `true` when the `Release` workflow ran.

After quite a bit of experimentation and research, I came to the
conclusion that we should just keep it simple (KISS and all that 🙈)
and just unify our whole CI into a single workflow which easily
achieves the setup we want.

Hopefully third time will be the charm to get our releases working via
GitHub Actions 🍀

## Changes

- Rename `Release` workflow jobs `deploy-github` and `deploy-cocoapods`
to `release-github` and `release-cocoapods` respectively.

- Move release workflow jobs to the `CI` Workflow, configured to only
run on tag pushes (`X.Y.Z`) and with dependencies on `build-test`,
`swiftpm`, `cocoapods` and `carthage` jobs.
  • Loading branch information
p4checo authored May 12, 2021
1 parent ac50c68 commit af7a9bc
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 62 deletions.
56 changes: 54 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
run: swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "${PLATFORM_TARGET}"

cocoapods:
name: CocoaPods verification
name: CocoaPods Verification
runs-on: macOS-10.15
steps:
- name: git checkout
Expand Down Expand Up @@ -103,11 +103,63 @@ jobs:
run: bundle exec pod lib lint

carthage:
name: Carthage verification
name: Carthage Verification
runs-on: macos-10.15
steps:
- name: git checkout
uses: actions/checkout@v2

- name: carthage build
run: ./script/carthage.sh build --cache-builds --no-skip-current

release-github:
name: GitHub Release
runs-on: macOS-10.15
needs: [build-test, swiftpm, cocoapods, carthage]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: git checkout
uses: actions/checkout@v2

- name: create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
# Changes
- <!-- Insert changes here -->
release-cocoapods:
name: CocoaPods Release
runs-on: macOS-10.15
needs: [build-test, swiftpm, cocoapods, carthage]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: git checkout
uses: actions/checkout@v2

- name: ruby versions
run: |
ruby --version
gem --version
bundler --version
- name: cache gems
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gem-

- name: bundle install
run: |
gem install bundler --no-document
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: pod trunk push
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: pod trunk push --allow-warnings
60 changes: 0 additions & 60 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit af7a9bc

Please sign in to comment.