diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e158960..961f0ff 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -2,31 +2,39 @@ on:
release:
types: [created]
-name: Upload tarball for release
+name: Create new formula version
jobs:
upload-release:
- name: Upload Release Asset
+ name: Create new formula version
runs-on: ubuntu-latest
steps:
- - name: Set release tarball name
- run: |
- echo "TARBALL_NAME=$(echo MakeColors-${GITHUB_REF##*/v})" >> $GITHUB_ENV
-
- - name: Checkout code
+ - name: Checkout formula repo
uses: actions/checkout@v2
-
- - name: Pack tarball
- run: |
- git archive HEAD --prefix=${{ env.TARBALL_NAME }}/ | bzip2 > ${{ env.TARBALL_NAME }}.tar.bz2
-
- - name: Upload Release Asset
- id: upload
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- upload_url: ${{ github.event.release.upload_url }}
- asset_path: ./${{ env.TARBALL_NAME }}.tar.bz2
- asset_name: ${{ env.TARBALL_NAME }}.tar.bz2
- asset_content_type: application/x-bzip2
+ repository: ${{ github.repository_owner }}/homebrew-makecolors
+ token: ${{ secrets.PUBLISH_FORMULA_TOKEN }}
+ - name: Update formula
+ run: |
+ cat << EOF > Formula/make-colors.rb
+ class MakeColors < Formula
+ desc "Converts a simple list of color definitions to asset catalogs for Xcode and resource XML for Android"
+ homepage "https://github.com/${{ github.repository }}"
+ url "https://github.com/${{ github.repository }}.git", :tag => "${{ github.event.release.tag_name }}", :revision => "${{ github.sha }}"
+ head "https://github.com/${{ github.repository }}.git"
+ license "MIT"
+
+ depends_on :xcode => ["14.0", :build]
+
+ def install
+ system "make", "install", "prefix=#{prefix}"
+ end
+ end
+ EOF
+
+ git config user.name github-actions
+ git config user.email github-actions@github.com
+
+ git add Formula/make-colors.rb
+ git commit -m "Update formula for ${{ github.event.release.tag_name }}"
+ git push
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index be00eaa..3b150ab 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -5,7 +5,7 @@ on:
jobs:
BuildAndTest:
- runs-on: macos-latest
+ runs-on: macos-12
steps:
- uses: actions/checkout@v1
diff --git a/.swift-version b/.swift-version
index d346e2a..760606e 100644
--- a/.swift-version
+++ b/.swift-version
@@ -1 +1 @@
-5.3
+5.7
diff --git a/Docs/assetcatalog.png b/Docs/assetcatalog.png
new file mode 100644
index 0000000..0340a76
Binary files /dev/null and b/Docs/assetcatalog.png differ
diff --git a/Docs/html.png b/Docs/html.png
new file mode 100644
index 0000000..46391a2
Binary files /dev/null and b/Docs/html.png differ
diff --git a/Example/.gitignore b/Example/.gitignore
new file mode 100644
index 0000000..5d1cee6
--- /dev/null
+++ b/Example/.gitignore
@@ -0,0 +1,2 @@
+Example.*
+!Example.txt
diff --git a/Example/Example.txt b/Example/Example.txt
new file mode 100644
index 0000000..c2be7ac
--- /dev/null
+++ b/Example/Example.txt
@@ -0,0 +1,10 @@
+Base/Green #8fd151
+Base/PaleGreen #d0f9a9
+Base/Red rgb(249, 39, 7)
+TransparentRed rgba(255, 0, 0, 128)
+Base/Yellow #ff0
+
+Error @Base/Red
+Warning @Base/Yellow
+Good @Base/Green
+
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..98c4dcc
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,17 @@
+prefix ?= /usr/local
+bindir = $(prefix)/bin
+
+build:
+ swift build -c release --disable-sandbox
+
+install: build
+ install -d "$(bindir)"
+ install ".build/release/MakeColors" "$(bindir)/make-colors"
+
+uninstall:
+ rm -rf "$(bindir)/make-colors"
+
+clean:
+ rm -rf .build
+
+.PHONY: build install uninstall clean
diff --git a/Package.resolved b/Package.resolved
index 228d9c6..717a74e 100644
--- a/Package.resolved
+++ b/Package.resolved
@@ -1,16 +1,23 @@
{
- "object": {
- "pins": [
- {
- "package": "swift-argument-parser",
- "repositoryURL": "https://github.com/apple/swift-argument-parser",
- "state": {
- "branch": null,
- "revision": "92646c0cdbaca076c8d3d0207891785b3379cbff",
- "version": "0.3.1"
- }
+ "pins" : [
+ {
+ "identity" : "rbbjson",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/robb/RBBJSON",
+ "state" : {
+ "branch" : "main",
+ "revision" : "102c970283e105d7c5be2e29630db29c808c20eb"
}
- ]
- },
- "version": 1
+ },
+ {
+ "identity" : "swift-argument-parser",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/apple/swift-argument-parser",
+ "state" : {
+ "revision" : "9f39744e025c7d377987f30b03770805dcb0bcd1",
+ "version" : "1.1.4"
+ }
+ }
+ ],
+ "version" : 2
}
diff --git a/Package.swift b/Package.swift
index ea9aaaa..05a09d5 100644
--- a/Package.swift
+++ b/Package.swift
@@ -1,4 +1,4 @@
-// swift-tools-version:5.3
+// swift-tools-version:5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
@@ -6,27 +6,25 @@ import PackageDescription
let package = Package(
name: "MakeColors",
platforms: [
- .macOS(.v10_15),
+ .macOS("12.0"),
],
dependencies: [
- .package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.3.1")),
+ .package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "1.1.4")),
+ .package(url: "https://github.com/robb/RBBJSON", branch: "main"),
],
targets: [
- .target(
+ .executableTarget(
name: "MakeColors",
- dependencies: [
- "LibMakeColors",
- ]
- ),
- .target(
- name: "LibMakeColors",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
]
),
.testTarget(
name: "MakeColorsTests",
- dependencies: ["LibMakeColors"]
+ dependencies: [
+ "MakeColors",
+ .product(name: "RBBJSON", package: "RBBJSON"),
+ ]
),
]
)
diff --git a/README.md b/README.md
index 23d4152..b9b8980 100644
--- a/README.md
+++ b/README.md
@@ -2,21 +2,70 @@
Converts a simple list of color definitions to asset catalogs for Xcode, resource XML for Android or an HTML preview.
+## Installation
+
+Install via [Homebrew](https://brew.sh):
+
+```
+brew tap 5sw/makecolors
+brew install make-colors
+```
+
+If you don’t use Homebrew you can also install directly from source. Clone the repository or download the release and run `make install` inside the working copy.
+
+## Usage
+
+```
+USAGE: make-colors [--ios] [--android] [--html] [--prefix ] [--output