All Projects → michaelhenry → deploy-to-cocoapods-github-action

michaelhenry / deploy-to-cocoapods-github-action

Licence: other
Github action for deploying to Cocoapods.org

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to deploy-to-cocoapods-github-action

bx-github-ci
This tutorial provides one example on how a CI (Continuous Integration) workflow with the IAR Build Tools for Linux can be set up on GitHub. The IAR Build Tools on Linux are available for Arm, RISC-V and Renesas (RH850, RL78 and RX).
Stars: ✭ 20 (-31.03%)
Mutual labels:  ci, github-actions
xray-action
... a GitHub action to import test results into "Xray" - A complete Test Management tool for Jira.
Stars: ✭ 16 (-44.83%)
Mutual labels:  ci, github-actions
branch-protection-bot
A bot tool to disable and re-enable "Include administrators" option in branch protection
Stars: ✭ 57 (+96.55%)
Mutual labels:  ci, github-actions
actions
A Collection of GitHub Actions
Stars: ✭ 91 (+213.79%)
Mutual labels:  ci, github-actions
update-container-description-action
github action to update a Docker Hub, Quay or Harbor repository description from a README file
Stars: ✭ 20 (-31.03%)
Mutual labels:  ci, github-actions
mylib
Шаблон кросплатформенного CMake-проекта для языка C++ 🇬🇧 Modern CMake crossplatform project template for C++
Stars: ✭ 49 (+68.97%)
Mutual labels:  ci, github-actions
AndroidFastlaneCICD
📱A sample repository to demonstrate the Automate publishing🚀 app to the Google Play Store with GitHub Actions⚡+ Fastlane🏃.
Stars: ✭ 82 (+182.76%)
Mutual labels:  ci, github-actions
changed-files
Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.
Stars: ✭ 733 (+2427.59%)
Mutual labels:  ci, github-actions
setup-scheme
Github Actions CI / CD setup for Scheme
Stars: ✭ 13 (-55.17%)
Mutual labels:  ci, github-actions
release-helper
🤖 A GitHub Action that help you publish release.
Stars: ✭ 27 (-6.9%)
Mutual labels:  ci, github-actions
overview
Automate your workflows with GitHub actions for MATLAB.
Stars: ✭ 40 (+37.93%)
Mutual labels:  ci, github-actions
arduino-lint-action
GitHub Actions action to check Arduino projects for problems
Stars: ✭ 20 (-31.03%)
Mutual labels:  ci, github-actions
setup-graalvm
No description or website provided.
Stars: ✭ 63 (+117.24%)
Mutual labels:  ci, github-actions
wordpress-skeleton
A base repository structure for rtCamp's WordPress sites, pre-configured to use Github Actions
Stars: ✭ 32 (+10.34%)
Mutual labels:  ci, github-actions
iOSDC2020-Talk-Sample
iOSDC 2020「GitHub ActionsでiOSアプリをCIする個人的ベストプラクティス」レギュラートークのサンプルリポジトリ
Stars: ✭ 35 (+20.69%)
Mutual labels:  ci, github-actions
prettier
🔨 Native, blazingly-fast Prettier CLI on Github Actions
Stars: ✭ 19 (-34.48%)
Mutual labels:  ci, github-actions
Cml
♾️ CML - Continuous Machine Learning | CI/CD for ML
Stars: ✭ 2,843 (+9703.45%)
Mutual labels:  ci, github-actions
Act
Run your GitHub Actions locally 🚀
Stars: ✭ 19,915 (+68572.41%)
Mutual labels:  ci, github-actions
action-junit-report
Reports junit test results as GitHub Pull Request Check
Stars: ✭ 103 (+255.17%)
Mutual labels:  ci, github-actions
install-swift
GitHub Action to install a version of Swift 🏎
Stars: ✭ 23 (-20.69%)
Mutual labels:  ci, github-actions

Deploy to cocoapods

Using this GitHub Action, you can deploy automatically your pod library to Cocoapods.org

Requirements

  • Must have register to cocoapod trunk. Please refer to Getting setup with Trunk on how to register.

  • Get your trunk token by using pod trunk me --verbose from your command line.

    Example response:

    opening connection to trunk.cocoapods.org:443...
    opened
    starting SSL for trunk.cocoapods.org:443...
    SSL established, protocol: TLSv1.2, cipher: ECDHE-RSA-AES128-GCM-SHA256
    <- "GET /api/v1/sessions HTTP/1.1\r\nContent-Type: application/json; charset=utf-8\r\nAccept: application/json; charset=utf-8\r\nUser-Agent: CocoaPods/1.7.4\r\nAuthorization: Token XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nHost: trunk.cocoapods.org\r\n\r\n"
    -> "HTTP/1.1 200 OK\r\n"
    -> "Date: Sun, 22 Sep 2019 05:11:46 GMT\r\n"
    -> "Connection: keep-alive\r\n"
    -> "Strict-Transport-Security: max-age=31536000\r\n"
    -> "Content-Type: application/json\r\n"
    -> "Content-Length: 1491\r\n"
    -> "X-Content-Type-Options: nosniff\r\n"
    -> "Server: thin 1.6.2 codename Doc Brown\r\n"
    -> "Via: 1.1 vegur\r\n"
    -> "\r\n"

    Please get only the XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX as your trunk token.

  • register the your trunk token as Secrets and named it as COCOAPODS_TRUNK_TOKEN.

Usage

The workflow, usually declared in .github/workflows/deploy_to_cocoapods.yml, looks like:

name: deploy_to_cocoapods

on:
  push:
    tags:
      - '*'

jobs:
  build:

    runs-on: macOS-latest

    steps:
    - uses: actions/checkout@v1
    
    - name: Install Cocoapods
      run: gem install cocoapods
    
    # shortcut version
    - uses: michaelhenry/[email protected]
      env:
        COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}

OR

name: deploy_to_cocoapods

on:
  push:
    tags:
      - '*'

jobs:
  build:

    runs-on: macOS-latest

    steps:
    - uses: actions/checkout@v1
    
    - name: Install Cocoapods
      run: gem install cocoapods
      
    - name: Deploy to Cocoapods
      run: |
        set -eo pipefail
        pod lib lint --allow-warnings
        pod trunk push --allow-warnings
      env:
        COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}

Example

An actual example can be found on this Repository: Autobot.

Recommendations

I also do recommend to automatically sync your library versioning with your git tags or releases. for example this *.spec file, I provided an environment variable for LIB_VERSION to use as the actual version, else it will goes to fallback version which is 1.0

Pod::Spec.new do |s|
  s.name             = 'AutoBot'
  s.version          = ENV['LIB_VERSION'] || '1.0' #fallback to major version
  s.summary          = 'UITestCases generator and executor for iOS Application.'
...
end

on the github action, we have to update the step Deploy to Cocoapods from

...
    - name: Deploy to Cocoapods
      run: |
        set -eo pipefail
        pod lib lint --allow-warnings
        pod trunk push --allow-warnings
      env:
        COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}

to

...
    - name: Deploy to Cocoapods
      run: |
        set -eo pipefail
        export LIB_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
        pod lib lint --allow-warnings
        pod trunk push --allow-warnings
      env:
        COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}

and that's all.

Cheers!

If you found some problems or encountered some troubles, please don't hessitate to let me know. I'm happy to help you!

LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].