From 9edb4ba6647263f9f8b99af327430ded99aa20ac Mon Sep 17 00:00:00 2001 From: giginet Date: Sun, 30 Jun 2024 16:49:28 +0900 Subject: [PATCH] Support Artifact Bundle --- .github/workflows/release.yml | 35 +++++++++++++++++++++++++++++++++++ .gitignore | 1 + Package.swift | 9 +++++++++ 3 files changed, 45 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b516644 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +on: + release: + types: [created] + +name: Upload Artifact Bundle to Release +env: + DEVELOPER_DIR: "/Applications/Xcode_15.3.app/Contents/Developer" + SWIFT_TESTING_REVOLUTIONARY_DEVELOPMENT: 1 + +jobs: + release: + name: Build and Upload Artifact Bundle + runs-on: macos-14 + steps: + - uses: actions/checkout@v3 + - name: Resolve Dependencies + run: | + swift package resolve + - name: Build Binary + run: | + swift build --disable-sandbox -c release --arch arm64 --arch x86_64 --target swift-testing-revolutionary + - name: Get Current Tag + run: echo "TAG_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Make Artifact Bundle + run: | + swift package --allow-writing-to-package-directory generate-artifact-bundle \ + --package-version ${{ env.TAG_NAME }} \ + --executable-name swift-testing-revolutionary \ + --build-config release \ + --build-folder .build + - name: Upload Artifact Bundle to Release + run: | + gh release upload ${{ env.TAG_NAME }} ./swift-testing-revolutionary.artifactbundle.zip + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 777dc81..5952f8a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ DerivedData/ .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata .netrc .swiftpm +*.artifactbundle.zip diff --git a/Package.swift b/Package.swift index 76171d1..5ffeb68 100644 --- a/Package.swift +++ b/Package.swift @@ -2,6 +2,7 @@ // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription +import Foundation let package = Package( name: "swift-testing-revolutionary", @@ -76,3 +77,11 @@ let package = Package( ], swiftLanguageVersions: [.v6] ) + +let isDevelopment = ProcessInfo.processInfo.environment["SWIFT_TESTING_REVOLUTIONARY_DEVELOPMENT"] == "1" + +if isDevelopment { + package.dependencies += [ + .package(url: "https://github.com/freddi-kit/ArtifactBundleGen.git", from: "0.0.6"), + ] +}