Skip to content

Commit

Permalink
Use Github Container Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
tshak authored Mar 31, 2021
1 parent acbe498 commit b52e473
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 18 deletions.
60 changes: 44 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@ jobs:
steps:

- name: Set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v2
with:
go-version: 1.15.1
go-version: 1.16.2
id: go

- name: Check out code
uses: actions/checkout@v1
uses: actions/checkout@v2

- name: Get dependencies
run: go mod download

- name: Lint
run: |
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.18.0
$(go env GOPATH)/bin/golangci-lint run
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.39.0
args: --timeout=5m

- name: Test
run: go test ./...
Expand All @@ -32,12 +30,42 @@ jobs:
if: contains(github.ref, 'refs/tags/v')
name: Create Release
runs-on: ubuntu-latest
env:
DOCKER_REPOSITORY: ${{ github.repository_owner }}/riser-controller
steps:
- name: Check out code
uses: actions/checkout@v1
- uses: jerray/[email protected]
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: |
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker build
uses: docker/build-push-action@v2
with:
push: true
build-args: VERSION=${{ steps.get_version.outputs.VERSION }}
tags: "ghcr.io/${{ env.DOCKER_REPOSITORY }}:${{ steps.get_version.outputs.VERSION }}"
cache-from: type=registry,ref=ghcr.io/${{ env.DOCKER_REPOSITORY }}
cache-to: type=registry,ref=ghcr.io/${{ env.DOCKER_REPOSITORY }}
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: riserplatform/riser-controller
auto_tag: true
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: true
body: |
Docker: `docker pull ghcr.io/${{ env.DOCKER_REPOSITORY }}:${{ steps.get_version.outputs.VERSION }}`
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build the manager binary
FROM golang:1.16-alpine as builder
RUN apk add --update --no-cache ca-certificates git
RUN apk add --no-cache ca-certificates git

WORKDIR /workspace

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<a href="https://github.com/riser-platform/riser-controller"><img alt="GitHub Actions status" src="https://github.com/riser-platform/riser-controller/workflows/Build/badge.svg"></a>
</p>

Kubernetes controller for the [Riser Platform](https://github.com/riser-platform/riser). Releases are pushed to [Docker Hub](https://hub.docker.com/r/riserplatform/riser-controller)
Kubernetes controller for the [Riser Platform](https://github.com/riser-platform/riser).

0 comments on commit b52e473

Please sign in to comment.