Skip to content

0.55.4

0.55.4 #17

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: Set Version Number
run: echo "Using version number $GITHUB_REF_NAME" && sed -i '' "s/let swiftFormatVersion = \"[^\"]*\"/let swiftFormatVersion = \"$GITHUB_REF_NAME\"/" Sources/SwiftFormat.swift
- name: Build macOS binary
run: swift build -c release --arch arm64 --arch x86_64 -Xswiftc -Osize
- name: Strip macOS binary
run: strip -rSTx .build/apple/Products/Release/swiftformat
- 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: Set Version Number
run: echo "Using version number $GITHUB_REF_NAME" && sed -i "s/let swiftFormatVersion = \"[^\"]*\"/let swiftFormatVersion = \"$GITHUB_REF_NAME\"/" Sources/SwiftFormat.swift
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install cross-binutils for aarch64
run: sudo apt install -y binutils-aarch64-linux-gnu
- name: Build and export binaries
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
target: builder
outputs: type=local,dest=artifacts
- name: Strip and Move binaries
run: |
strip artifacts/linux_amd64/workspace/swiftformat
mv artifacts/linux_amd64/workspace/swiftformat "${HOME}/swiftformat_linux"
aarch64-linux-gnu-strip artifacts/linux_arm64/workspace/swiftformat
mv artifacts/linux_arm64/workspace/swiftformat "${HOME}/swiftformat_linux_aarch64"
- name: Upload AMD64 Artifact
uses: actions/upload-artifact@v4
with:
name: swiftformat_linux
path: ~/swiftformat_linux
retention-days: 5
- name: Upload ARM64 Artifact
uses: actions/upload-artifact@v4
with:
name: swiftformat_linux_aarch64
path: ~/swiftformat_linux_aarch64
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
pattern: swiftformat_*
- 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 downloaded_artifacts/swiftformat_linux_aarch64/swiftformat_linux_aarch64
- name: Upload artifact bundle
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'swiftformat.artifactbundle.zip'