Skip to content

Workflow file for this run

on:
release:
types: [published]
name: Build Release Artifacts
jobs:
macos:
name: Build macOS binary
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build macOS binary
run: swift build -c release --arch arm64 --arch x86_64
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: swiftformat_macos
path: .build/apple/Products/Release/swiftformat
retention-days: 5
linux:
name: Build SwiftFormat for Linux
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build it
run: |
swift build --configuration release --static-swift-stdlib --enable-dead-strip
SWIFTFORMAT_BIN_PATH=`swift build --configuration release --show-bin-path`
mv $SWIFTFORMAT_BIN_PATH/swiftformat "${HOME}/swiftformat_linux"
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: swiftformat_linux
path: ~/swiftformat_linux
retention-days: 5
upload:
name: Upload release artifacts
runs-on: ubuntu-latest
needs: [macos, linux]
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: downloaded_artifacts
- name: Display structure of downloaded files
run: ls -R downloaded_artifacts
- name: Build artifact bundle
run: ./Scripts/spm-artifact-bundle.sh ${{ github.event.release.name }} downloaded_artifacts/swiftformat_macos/swiftformat downloaded_artifacts/swiftformat_linux/swiftformat_linux
- name: Upload artifact bundle
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'swiftformat.artifactbundle.zip'