Skip to content

Commit

Permalink
[Feature] Update github workflows ci
Browse files Browse the repository at this point in the history
Update github workflows ci

Fixes #22 #40

Signed-off-by: zhuhuijun <[email protected]>
  • Loading branch information
Ghostbaby committed Oct 11, 2020
1 parent f2270b3 commit 56b5e59
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 17 deletions.
43 changes: 26 additions & 17 deletions .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,33 @@ name: CI
on:
push:
branches:
- 'master'
- '**'
pull_request:
branches:
- master

jobs:
docker:
# Dockerfile tests
docker-build-test:
runs-on: ubuntu-latest
name: Build and Test

steps:
- uses: actions/checkout@v2
- run: |
curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_linux_amd64.tar.gz | tar -xz -C /tmp/
sudo mv /tmp/kubebuilder_2.3.1_linux_amd64 /usr/local/kubebuilder
- name: Docker Build & Push to Docker Hub
uses: opspresso/action-docker@master
with:
args: --docker
env:
USERNAME: ${{ secrets.DOCKER_USER }}
PASSWORD: ${{ secrets.DOCKER_TOKEN }}
DOCKERFILE: Dockerfile
IMAGE_NAME: ghostbaby/zookeeper-operator
TAG_NAME: dev
LATEST: 'false'
- uses: actions/checkout@v2
- name: install kubebuilder
run: |
curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_linux_amd64.tar.gz | tar -xz -C /tmp/
sudo mv /tmp/kubebuilder_2.3.1_linux_amd64 /usr/local/kubebuilder
- run: make test docker-build
- name: Docker Build & Push to Docker Hub
if: ${{ github.ref == 'refs/heads/master' }}
uses: opspresso/action-docker@master
with:
args: --docker
env:
USERNAME: ${{ secrets.DOCKER_USER }}
PASSWORD: ${{ secrets.DOCKER_TOKEN }}
DOCKERFILE: Dockerfile
IMAGE_NAME: ghostbaby/zookeeper-operator
TAG_NAME: dev
LATEST: 'false'
38 changes: 38 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
push:
tags:
- 'v*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Unshallow
# required for the changelog to work correctly
run: git fetch --prune --unshallow
-
name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.13
-
name: prepare changelog
run: |
tag=${{ github.ref }}
tag=${tag##*/}
cat <<EOF | tee /tmp/release.txt
## Docker images
- \`docker pull ghostbaby/zookeeper-operator:$tag\`
EOF
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: v0.129.0
args: release --rm-dist --release-footer /tmp/release.txt
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
release:
types:
- created
- published

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# opspresso/action-docker use body of ./target/TAG_NAME as docker tag
# https://github.com/opspresso/action-docker#common-env
- run: mkdir ./target
- run: echo -n '${{ github.ref }}' | sed 's|refs/tags/||' > ./target/TAG_NAME
- name: Docker Build & Push to Docker Hub
uses: opspresso/action-docker@master
with:
args: --docker
env:
USERNAME: '${{ secrets.DOCKER_USER }}'
PASSWORD: '${{ secrets.DOCKER_TOKEN }}'
LATEST: 'false'

0 comments on commit 56b5e59

Please sign in to comment.