Skip to content
This repository has been archived by the owner on Mar 13, 2021. It is now read-only.

Commit

Permalink
Switch from Travis to GitHub Actions (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
scothis authored Oct 9, 2019
1 parent 5de4b59 commit ae09ed2
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 24 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on: [push, pull_request]

jobs:

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-go@v1
with:
go-version: '1.13'
- name: Install pack
run: .github/workflows/install-pack.sh
- name: Create Builder
run: .github/workflows/create-builder.sh
- name: Test Builder
run: make test

publish:
needs: test
if: |
github.event_name == 'push' && (
github.ref == 'refs/heads/master' || (
startsWith(github.ref, 'refs/heads/v') && endsWith(github.ref, 'x')
)
)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-go@v1
with:
go-version: '1.13'
- name: Install pack
run: .github/workflows/install-pack.sh
- name: Create Builder
run: .github/workflows/create-builder.sh
- name: gcloud auth
run: |
gcloud config set disable_prompts True
gcloud auth activate-service-account --key-file <(echo $GCLOUD_CLIENT_SECRET | base64 --decode)
env:
GCLOUD_CLIENT_SECRET: ${{ secrets.GCLOUD_CLIENT_SECRET }}
- name: docker login
run: docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Publish Image
run: .github/workflows/push-to-dockerhub.sh ${{ github.ref }}
- name: Publish Builder
run: .github/workflows/push-buildtemplate-to-gcs.sh ${{ github.ref }}
File renamed without changes.
4 changes: 2 additions & 2 deletions .travis/install-pack.sh → .github/workflows/install-pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ set -o errexit
set -o nounset
set -o pipefail

wget -qO- https://github.com/buildpack/pack/releases/download/v0.4.1/pack-v0.4.1-linux.tgz | tar xvz -C $HOME/bin
export PATH="$HOME/bin:$PATH"
wget -qO- https://github.com/buildpack/pack/releases/download/v0.4.1/pack-v0.4.1-linux.tgz | tar xvz -C .
sudo mv pack /usr/local/bin/
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ set -o nounset
set -o pipefail

readonly version=$(cat VERSION)
readonly git_branch=${TRAVIS_BRANCH}
readonly git_branch=${1:11} # drop 'refs/head/' prefix
readonly git_sha=$(git rev-parse HEAD)
readonly git_timestamp=$(TZ=UTC git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd")
readonly slug=${version}-${git_timestamp}-${git_sha:0:16}

gcloud auth activate-service-account --key-file <(echo $GCLOUD_CLIENT_SECRET | base64 --decode)

# function build template
echo "Publish function builder"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ set -o nounset
set -o pipefail

readonly version=$(cat VERSION)
readonly git_branch=${TRAVIS_BRANCH}
readonly git_branch=${1:11} # drop 'refs/head/' prefix
readonly git_sha=$(git rev-parse HEAD)
readonly git_timestamp=$(TZ=UTC git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd")
readonly slug=${version}-${git_timestamp}-${git_sha:0:16}

docker tag projectriff/builder:latest projectriff/builder:${version}
docker tag projectriff/builder:latest projectriff/builder:${slug}

docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
docker push projectriff/builder:${version}
docker push projectriff/builder:${slug}
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

0 comments on commit ae09ed2

Please sign in to comment.