Skip to content

Create Artifact Bundle

Actions
Create artifact bundle for Swift Package
v2.1.0
Latest
Star (10)

Tags

 (1)

GitHub Action Artifact Bundle

GitHub Super-Linter CI Check dist/ Coverage

A GitHub Action to create a archive in Apple Artifact bundle format. It's is useful for distributing binaries built from Swift Package for Package Plugin or using nest.

Features

  • Create Artifact Bundle from Swift Package
  • Auto checksum calculation
  • Support for multiple architectures
  • Support for universal binary
  • Support for Linux binary
  • Support for package resources

Usage

Note

You can refer to the example in giginet/github-action-artifactbundle-example

This plugin collect executables from the repository and compress them into *.artifactbundle.zip. This plugin just make a bundle, so you need to set up the steps to build Swift Package before this plugin.

on:
  release:
    types: [published, edited]
name: Upload Artifact Bundle to Release
env:
  DEVELOPER_DIR: '/Applications/Xcode_16.2.app/Contents/Developer'
jobs:
  release:
    runs-on: macos-15
    steps:
      - uses: actions/checkout@v4
      - name: Build Universal Binary
        run: swift build --disable-sandbox -c release --arch arm64 --arch x86_64
      - uses: giginet/github-action-artifactbundle@v2
        id: artifactbundle
        with:
          artifact_name: myexecutable
      - name: Upload Artifact Bundle to Release
        run: |
          BODY="${{ github.event.release.body }}"
          BUNDLE_PATH="${{ steps.artifactbundle.outputs.bundle_path }}"
          SHA256="${{ steps.artifactbundle.outputs.bundle_sha256 }}"
          TAG_NAME="${{ github.event.release.tag_name }}"
          gh release upload "${TAG_NAME}" "${BUNDLE_PATH}"
          NEW_BODY="$(printf "%s\n%s" "$BODY" "$SHA256")"
          gh release edit "${TAG_NAME}" --notes "${NEW_BODY}"
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Note

You need to configure the permission in the GitHub Action settings to upload the artifacts. See Details for the documentation.

Inputs

Required Key Description Default Value
artifact_name Name of the executable to collect
version Version of the artifact ${{ github.event.release.tag_name | ${{ github.ref_name }}
package_path Path to the package directory ./
output_path Path to output directory for artifact bundle ./.artifacts
configuration Build configuration (debug/release) release

Action Outputs

Key Description Value
bundle_path Absolute pass to the created artifact bundle /path/to/.artifacts/myexecutable.artifactbundle.zip
bundle_sha256 SHA256 hash of the bundle 6ac5405041deec86c371ce71e5f7e56b0c7122f4
bundle_filename Filename of the bundle myexecutable.artifactbundle.zip

Build Linux Binary

The Swift compiler supports cross-compilation. If you want to make a Linux binary, you can refer the following steps.

jobs:
  release:
    steps:
      - name: Install Linux SDK
        run:
          swift sdk install
          https://download.swift.org/swift-6.0.3-release/static-sdk/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz
      - name: 'Build for Linux(x86_64)'
        run: swift build --swift-sdk x86_64-swift-linux-musl
      - name: 'Build for Linux(arm64)'
        run: swift build --swift-sdk aarch64-swift-linux-musl

See details for Swift.org - Getting Started with the Static Linux SDK.

This action automatically gather the executables for each architecture and they'll be included to a bundle.

License

MIT License

Create Artifact Bundle is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Create artifact bundle for Swift Package
v2.1.0
Latest

Tags

 (1)

Create Artifact Bundle is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.