diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..4560d2d5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +on: + push: + tags: + - '*' +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: bazel build //Libraries:xcbuild + - id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + - uses: actions/upload-release-asset@v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: bazel-bin/Libraries/xcbuild.tar.xz + asset_name: xcbuild.tar.xz + asset_content_type: application/x-xz diff --git a/Libraries/BUILD b/Libraries/BUILD new file mode 100644 index 00000000..f7e42399 --- /dev/null +++ b/Libraries/BUILD @@ -0,0 +1,14 @@ +load("@rules_pkg//:pkg.bzl", "pkg_tar") + +pkg_tar( + name = "xcbuild", + srcs = [ + "//Libraries/acdriver:actool", + "//Libraries/plist:PlistBuddy", + "//Libraries/plist:plutil", + "//Libraries/xcdriver:xcodebuild", + "//Libraries/xcsdk:xcode-select", + "//Libraries/xcsdk:xcrun", + ], + extension = "tar.xz", +) diff --git a/Libraries/xcdriver/BUILD b/Libraries/xcdriver/BUILD index 143e2d9f..4c782458 100644 --- a/Libraries/xcdriver/BUILD +++ b/Libraries/xcdriver/BUILD @@ -1,3 +1,5 @@ +load("@bazel_skylib//rules:copy_file.bzl", "copy_file") + cc_library( name = "xcdriver", srcs = glob(["Sources/**/*.cpp"]), @@ -23,3 +25,11 @@ cc_binary( srcs = ["Tools/xcbuild.cpp"], deps = [":xcdriver"], ) + +copy_file( + name = "xcodebuild_bin", + src = ":xcbuild", + out = "xcodebuild", + allow_symlink = True, + visibility = ["//visibility:public"], +) diff --git a/WORKSPACE b/WORKSPACE index 06e842f0..d5e2ac3b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -40,3 +40,25 @@ http_archive( "https://github.com/antirez/linenoise/archive/97d2850af13c339369093b78abe5265845d78220.tar.gz", ], ) + +http_archive( + name = "bazel_skylib", + sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", + ], +) + +http_archive( + name = "rules_pkg", + sha256 = "038f1caa773a7e35b3663865ffb003169c6a71dc995e39bf4815792f385d837d", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz", + "https://github.com/bazelbuild/rules_pkg/releases/download/0.4.0/rules_pkg-0.4.0.tar.gz", + ], +) + +load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") + +rules_pkg_dependencies()