Skip to content

Commit

Permalink
Publish on merges to master (linkerd#202)
Browse files Browse the repository at this point in the history
* Publish on merges to master

* Use hugo-extended
  • Loading branch information
grampelberg authored Feb 28, 2019
1 parent fb9c3f8 commit e0e0a31
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 12 deletions.
45 changes: 34 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
version: 2
jobs:
build:
test:
docker:
- image: circleci/node:10
- image: gcr.io/linkerd-io/website-builder:1.1

working_directory: ~/website
steps:
- checkout

- run:
name: Install dependencies
command: |-
wget https://github.com/gohugoio/hugo/releases/download/v0.54.0/hugo_0.54.0_Linux-64bit.deb
sudo dpkg -i hugo*.deb
curl https://htmltest.wjdp.uk | bash
sudo mv bin/htmltest /usr/local/bin
sudo npm install -g markdownlint-cli
- run:
name: Validate markdown
command: |-
Expand All @@ -26,3 +17,35 @@ jobs:
name: Check for bad links
command: |-
make check
publish:
docker:
- image: gcr.io/linkerd-io/website-builder:1.1

working_directory: ~/website
steps:
- checkout

- run:
name: Configure gcloud cli
command: |-
echo ${GSTOKEN} > /tmp/token.json
gcloud auth activate-service-account --key-file=/tmp/token.json
- run:
name: Publish
command: |-
make publish
workflows:
version: 2
publish:
jobs:
- test
- publish:
requires:
- test
filters:
branches:
only:
- master
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM circleci/node:10

USER root

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
lsb-core \
apt-transport-https \
&& export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" \
&& echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" \
| tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
| apt-key add - \
&& apt-get update \
&& apt-get install -y --no-install-recommends google-cloud-sdk \
&& wget https://github.com/gohugoio/hugo/releases/download/v0.54.0/hugo_extended_0.54.0_Linux-64bit.deb \
&& dpkg -i hugo*.deb \
&& rm hugo*.deb \
&& curl https://htmltest.wjdp.uk | bash \
&& mv bin/htmltest /usr/local/bin \
&& npm install -g markdownlint-cli \
&& rm -rf /var/lib/apt/lists/*

USER circleci

17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export PROJECT ?= linkerd-site
RELEASE_URL = https://github.com/linkerd/linkerd2/releases
export L5D2_STABLE_VERSION ?= stable-2.2.1
export L5D2_EDGE_VERSION ?= edge-19.2.5
export BUILD_IMAGE ?= gcr.io/linkerd-io/website-builder:1.1

GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
GIT_HASH = $(shell git log --pretty=format:'%h' -n 1)
Expand All @@ -28,7 +29,7 @@ update-version: replace-env-L5D2_STABLE_VERSION replace-env-L5D2_EDGE_VERSION
@# Update the version for the %* site

.PHONY: deploy-%
deploy-%: tmp/%*/public
deploy-%: tmp/%/public
@# Upload a site to the correct bucket.
@# Options:
@#
Expand Down Expand Up @@ -129,3 +130,17 @@ has-env-%:
.PHONY: clean
clean:
rm -rf tmp

.PHONY: update-build-image
update-build-image: docker-build docker-push
@# Build and push the build image

.PHONY: docker-build
docker-build:
@# Build the build image
docker build -t $(BUILD_IMAGE) .

.PHONY: docker-push
docker-push:
@# Push the build image
docker push $(BUILD_IMAGE)

0 comments on commit e0e0a31

Please sign in to comment.