Shipunk

CI/CD Integration

Automate releases with GitHub Actions

CI/CD Integration

Automate your releases with GitHub Actions or other CI/CD platforms.

GitHub Actions

Basic workflow

Create .github/workflows/release.yml:

name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Xcode
        uses: maxim-lobanov/setup-xcode@v1
        with:
          xcode-version: latest-stable
      
      - name: Build app
        run: |
          xcodebuild archive \
            -scheme MyApp \
            -archivePath build/MyApp.xcarchive
          
          xcodebuild -exportArchive \
            -archivePath build/MyApp.xcarchive \
            -exportPath build \
            -exportOptionsPlist ExportOptions.plist
      
      - name: Create DMG
        run: |
          npm install -g create-dmg
          create-dmg build/MyApp.app build/ || true
          mv "build/MyApp "*.dmg build/MyApp.dmg
      
      - name: Upload to Shipunk
        env:
          SHIPUNK_API_KEY: ${{ secrets.SHIPUNK_API_KEY }}
        run: |
          npx shipunk release upload build/MyApp.dmg \
            --app myapp \
            --version ${GITHUB_REF#refs/tags/v}

With release notes from tag

- name: Get release notes
  id: notes
  run: |
    echo "notes<<EOF" >> $GITHUB_OUTPUT
    git tag -l --format='%(contents)' ${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT
    echo "EOF" >> $GITHUB_OUTPUT

- name: Upload to Shipunk
  env:
    SHIPUNK_API_KEY: ${{ secrets.SHIPUNK_API_KEY }}
  run: |
    npx shipunk release upload build/MyApp.dmg \
      --app myapp \
      --version ${GITHUB_REF#refs/tags/v} \
      --notes "${{ steps.notes.outputs.notes }}"

With changelog file

- name: Upload to Shipunk
  env:
    SHIPUNK_API_KEY: ${{ secrets.SHIPUNK_API_KEY }}
  run: |
    npx shipunk release upload build/MyApp.dmg \
      --app myapp \
      --version ${GITHUB_REF#refs/tags/v} \
      --notes-file CHANGELOG.md

Setting up secrets

  1. Go to your repository Settings → Secrets and variables → Actions
  2. Click New repository secret
  3. Name: SHIPUNK_API_KEY
  4. Value: Your API key from Shipunk dashboard

Other CI platforms

GitLab CI

release:
  stage: deploy
  image: node:20
  only:
    - tags
  script:
    - npx shipunk release upload build/MyApp.dmg
        --app myapp
        --version ${CI_COMMIT_TAG#v}
  variables:
    SHIPUNK_API_KEY: $SHIPUNK_API_KEY

CircleCI

version: 2.1

jobs:
  release:
    macos:
      xcode: 15.0
    steps:
      - checkout
      - run:
          name: Upload to Shipunk
          command: |
            npx shipunk release upload build/MyApp.dmg \
              --app myapp \
              --version ${CIRCLE_TAG#v}

workflows:
  release:
    jobs:
      - release:
          filters:
            tags:
              only: /^v.*/
            branches:
              ignore: /.*/

Tips

Version extraction

Extract version from git tag:

# From v1.2.3 to 1.2.3
VERSION=${GITHUB_REF#refs/tags/v}

Build number from CI

Use CI build number:

npx shipunk release upload MyApp.dmg \
  --app myapp \
  --version 1.2.3 \
  --build ${GITHUB_RUN_NUMBER}

Conditional releases

Only release on tagged commits:

on:
  push:
    tags:
      - 'v*'

Or manually trigger:

on:
  workflow_dispatch:
    inputs:
      version:
        description: 'Version number'
        required: true