Created
January 5, 2012 23:43
-
-
Save atdt/1568022 to your computer and use it in GitHub Desktop.
Build and upload Chrome extensions to GitHub using APIv3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXTNAME := extension | |
KEYFILE := $(EXTNAME).pem | |
CRXFILE := $(EXTNAME).crx | |
EXTDIR := $(EXTNAME) | |
SHELL := /usr/bin/env bash | |
CHROME := open /Applications/Google\ Chrome.app -n --args | |
CWD := $(shell pwd) | |
SIZE := $(shell wc -c <$(CRXFILE) | tr -d ' ') | |
VERSION := $(shell python -c "import json,sys;print json.loads(sys.stdin.read()).get('version','')" < $(EXTDIR)/manifest.json) | |
ZIPFILE := $(EXTNAME)-$(VERSION).crx | |
GITHUB_USERNAME := atdt | |
GITHUB_REPOSITORY := chrome-open-as-media-type # make this $(EXTNAME)? | |
all: pack | |
pack: | |
$(CHROME) --pack-extension=$(CWD)/extension \ | |
--pack-extension-key=$(CWD)/extension.pem --no-message-box | |
upload: | |
echo $(SIZE) $(VERSION) | |
curl -v \ | |
-u "$(GITHUB_USERNAME):$(GITHUB_PASSWORD)" \ | |
-d '{"name": "$(ZIPFILE)", "size": "$(SIZE)", "description": "Version $(VERSION)"}' \ | |
https://api.github.com/repos/$(GITHUB_USERNAME)/$(GITHUB_REPOSITORY)/downloads |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: