Skip to content

Commit

Permalink
Merge pull request #27 from astronomerio/feature/add-circle-ci
Browse files Browse the repository at this point in the history
prep for circle ci
  • Loading branch information
andscoop committed Feb 23, 2018
2 parents 4e3591b + c39bd66 commit 509f132
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 4 deletions.
53 changes: 53 additions & 0 deletions .circleci/circle.yml
@@ -0,0 +1,53 @@
defaults: &defaults
working_directory: /go/src/github.com/astronomerio/astro-cli

version: 2
jobs:
build:
<<: *defaults
docker:
- image: circleci/golang:1.10
steps:
- checkout
- run:
name: "astro-cli version:"
command: |
echo $CIRCLE_TAG
deploy:
<<: *defaults
docker:
- image: circleci/golang:1.10
steps:
- checkout
- run:
name: "Write metadata"
command: |
if [ "${CIRCLE_TAG}" != "" ]; then
./.circleci/scripts/write_metadata.sh $CIRCLE_TAG "`date '+%B %d, %Y @ %H:%M:%S'`"
else
echo "Not tagged, skipping step"
fi
- run:
name: "Install Goreleaser"
command: |
if [ "${CIRCLE_TAG}" != "" ]; then
curl -sL https://git.io/goreleaser | bash
else
echo "Not tagged, skipping step"
fi
workflows:
version: 2
distribute:
jobs:
- build:
filters:
branches:
only: master
tags:
only: /^v\d[\d\.]+/
- deploy:
requires:
- build
filters:
tags:
only: /^v\d[\d\.]+/
9 changes: 9 additions & 0 deletions .circleci/scripts/write_metadata.sh
@@ -0,0 +1,9 @@
#!/bin/bash

VERSION=$1
BUILD_DATE="`date '+%B %d, %Y @ %H:%M:%S'`"
CONTENT="package meta\n\nvar VERSION = \"$VERSION\"\nvar BUILD_DATE = \"$BUILD_DATE\""

mkdir -p meta

printf "$CONTENT" > ./meta/meta.go
4 changes: 4 additions & 0 deletions .gitignore
@@ -1 +1,5 @@
.astro/
astro
Dockerfile
packages.txt
requirements.txt
8 changes: 4 additions & 4 deletions .goreleaser.yml
@@ -1,10 +1,10 @@
project_name: astro
project_name: astro-cli
release:
github:
owner: astronomerio
name: astro
name: astro-cli
brew:
install: bin.install "astro"
install: bin.install "astro-cli"
builds:
- goos:
- linux
Expand All @@ -16,7 +16,7 @@ builds:
goarm:
- "6"
main: .
ldflags: -s -w -X main.version={{ .Version }} -X main.commit={{ .Commit }} -X main.date={{ .Dat e}}
ldflags: -s -w -X main.version={{ .Version }} -X main.commit={{ .Commit }} -X main.date={{ .Date }}
binary: astro
ignore:
- goos: windows
Expand Down

0 comments on commit 509f132

Please sign in to comment.