Skip to content

Merge pull request #118 from mittwald/task/allow-patch-on-pvcs #516

Merge pull request #118 from mittwald/task/allow-patch-on-pvcs

Merge pull request #118 from mittwald/task/allow-patch-on-pvcs #516

Workflow file for this run

name: Go
# Trigger the workflow on push or pull requests
on:
push:
branches:
- 'master'
tags:
- '*'
pull_request:
env:
KUBECONFIG: /tmp/kubeconfig
IMAGE_NAME: quay.io/mittwald/harbor-operator
REGISTRY_URL: quay.io/mittwald
GOLANGCI_LINT_VERSION: v1.57.2
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v2
with:
go-version: 1.22
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Install golangci-lint
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin "${GOLANGCI_LINT_VERSION}"
- name: Run golangci-lint
run: $(go env GOPATH)/bin/golangci-lint run -v --timeout 30m
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v2
with:
go-version: 1.22
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Go Test
if: github.event_name == 'pull_request'
run: sudo ln -sf /bin/bash /bin/sh && make test
build:
name: Build Image
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v2
with:
go-version: 1.22
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Build Image
run: sudo ln -sf /bin/bash /bin/sh && make docker-build
deploymaster:
name: Deploy Latest Image
runs-on: ubuntu-latest
needs: ['test', 'build']
if: github.ref == 'refs/heads/master'
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v2
with:
go-version: 1.22
id: go
- name: Registry Login
run: docker login -u "${{ secrets.dockerLoginUsername }}" -p "${{ secrets.dockerLoginPassword }}" "${REGISTRY_URL}"
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Build latest image
run: make docker-build
- name: Push latest tag
run: make docker-push
deploytagged:
name: Deploy Tagged Image
runs-on: ubuntu-latest
needs: ['test', 'build']
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v2
with:
go-version: 1.22
id: go
- name: Registry Login
run: docker login -u "${{ secrets.dockerLoginUsername }}" -p "${{ secrets.dockerLoginPassword }}" "${REGISTRY_URL}"
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Build tagged image
run: make docker-build
- name: Tag versioned image
run: docker tag "$IMAGE_NAME:latest" "$IMAGE_NAME:${GITHUB_REF##*/}"
- name: Push images
run: docker push "$IMAGE_NAME:latest" && docker push "$IMAGE_NAME:${GITHUB_REF##*/}"
- name: Bump chart version
uses: mittwald/bump-app-version-action@v1
with:
mode: 'publish'
chartYaml: './deploy/chart/Chart.yaml'
env:
GITHUB_TOKEN: "${{ secrets.GITHUBTOKEN }}"
HELM_REPO_PASSWORD: "${{ secrets.HELM_REPO_PASSWORD }}"