Add rules for uploading to hackage

While it would be really nice to run this from CI,
The only way to upload a package involves using account-wide credentials.
We can either use a username/password, or an API token.
Both of these credentials have the same privileges,
and that's too much power to give to CI.

For now, we run this from the local machine.
Maybe we can think of another way that's a bit safer.
This commit is contained in:
joneshf 2018-07-27 05:03:47 -07:00
parent e1dfee6745
commit d5d6d73769
No known key found for this signature in database
GPG Key ID: C8FFFC4E889B880E
2 changed files with 45 additions and 4 deletions

View File

@ -1,5 +1,14 @@
version: 2
jobs:
sdist:
docker:
- image: haskell:8.2.2
steps:
- checkout
- run:
name: Build sdist
command: make sdist
test:
docker:
- image: haskell:8.2.2
@ -20,8 +29,10 @@ jobs:
paths:
- .stack-work
- /root/.stack
workflows:
version: 2
base:
jobs:
- sdist
- test

View File

@ -1,4 +1,9 @@
PROJECT_NAME := rollbar-hs
BIN := bin
CABAL := cabal
CABAL_FILE := $(PROJECT_NAME).cabal
DIST := dist
EMPTY := .make
GHCID := $(BIN)/ghcid
STACK := stack
@ -6,30 +11,55 @@ STACK_WORK := .stack-work
.DEFAULT_GOAL := build
$(BIN):
mkdir -p $@
$(DIST):
mkdir -p $@
$(EMPTY):
mkdir $@
mkdir -p $@
$(EMPTY)/stack-setup: | $(EMPTY)
$(STACK) setup
touch $@
$(GHCID): $(EMPTY)/stack-setup
$(GHCID): $(EMPTY)/stack-setup | $(BIN)
$(STACK) install ghcid --local-bin-path $(BIN)
$(CABAL_FILE):
# `stack` has no way to run `hpack` directly.
# We can run `hpack` indirectly with little overhead.
$(STACK) build --dry-run
.PHONY: build
build: $(EMPTY)/stack-setup
$(STACK) build --no-run-tests --test
.PHONY: cabal-check
cabal-check: $(CABAL_FILE)
$(CABAL) check
.PHONY: clean
clean:
rm -f $(BIN)/*
rm -f $(EMPTY)/*
rm -f $(CABAL_FILE)
rm -fr $(BIN)
rm -fr $(DIST)
rm -fr $(EMPTY)
rm -fr $(STACK_WORK)
.PHONY: sdist
sdist: cabal-check | $(DIST)
$(CABAL) sdist
.PHONY: test
test: build
$(STACK) test
.PHONY: upload-hackage
upload-hackage: sdist
@ $(CABAL) upload $(DIST)/$(PROJECT_NAME)-*.tar.gz
.PHONY: watch
watch: $(GHCID)
$(GHCID)