feat: Global service #57
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CD / Controller | |
on: | |
pull_request: | |
branches: | |
- "master" | |
paths: | |
- "controller/**" | |
push: | |
tags: | |
- 'v*.*.*' | |
permissions: | |
contents: read | |
env: | |
GOPATH: /home/runner/go | |
GOBIN: /home/runner/go/bin | |
GOPROXY: "https://proxy.golang.org" | |
jobs: | |
test: | |
name: Unit test | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
shell: bash | |
working-directory: controller | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Set up Go | |
uses: actions/[email protected] | |
with: | |
go-version-file: controller/go.mod | |
cache: true | |
- name: Download dependencies | |
run: go mod download | |
- name: Download tools | |
run: make tools | |
- name: Test | |
run: make test | |
publish-docker: | |
name: Build and push controller container | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
shell: bash | |
working-directory: controller | |
needs: [ test ] | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
packages: 'write' | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/pluralsh/deployment-controller | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build and push | |
uses: docker/[email protected] | |
with: | |
context: "./controller" | |
file: "./controller/Dockerfile" | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
GIT_COMMIT=${{ github.sha }} | |
VERSION=${{ steps.meta.outputs.version }} |