Skip to content

Commit

Permalink
build: update gh-action components and go to 1.19
Browse files Browse the repository at this point in the history
build: switch to ko-build/setup-ko

build: update helm-gh-pages action

build: fix token check

build: configure dependabot for gh-actions
  • Loading branch information
clementnuss committed Feb 21, 2023
1 parent 3c55012 commit c47466f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 472 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ updates:
schedule:
interval: "weekly"
target-branch: main

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
52 changes: 26 additions & 26 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
name: Test and publish
name: Publish

on: [push, pull_request]
on: [push]

jobs:
check-gh-token:
runs-on: ubuntu-latest
outputs:
gh-token: ${{ steps.gh-token.outputs.defined }}
HAS_DOCKERHUB_TOKEN: ${{ steps.gh-token.outputs.HAS_DOCKERHUB_TOKEN }}
steps:
- id: gh-token
env:
MY_KEY: ${{ secrets.GITHUB_TOKEN }}
if: "${{ env.MY_KEY != '' }}"
run: echo "::set-output name=defined::true"
HAS_DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN != '' }}
run: |
echo "HAS_DOCKERHUB_TOKEN=$HAS_DOCKERHUB_TOKEN" >> $GITHUB_OUTPUT
echo "HAS_DOCKERHUB_TOKEN=$HAS_DOCKERHUB_TOKEN" >> $GITHUB_STEP_SUMMARY
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19

- name: install and run golangci-lint
uses: golangci/golangci-lint-action@v3.2.0
uses: golangci/golangci-lint-action@v3.4.0
with:
version: v1.48.0
skip-go-installation: true
version: v1.51.2
args: --timeout=3m

test:
Expand All @@ -35,15 +35,15 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19

- name: Download K8s envtest - local K8s cluster control plane
run: |
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
mkdir -p local/envtest-bin/
setup-envtest use -p env 1.24.x --bin-dir local/envtest-bin > local/envtest-bin/env
- name: Run Unit tests
- name: Run Unit tests @
run: |
source local/envtest-bin/env
export KUBEBUILDER_ASSETS=$(pwd)/$KUBEBUILDER_ASSETS
Expand Down Expand Up @@ -73,9 +73,9 @@ jobs:
uses: helm/[email protected]
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19
stable: true
- uses: imjasonh/[email protected]
- uses: ko-build/[email protected]
name: Setup ko
env:
KO_DOCKER_REPO: docker.io/postfinance
Expand Down Expand Up @@ -115,20 +115,20 @@ jobs:
if: |
startsWith(github.ref, 'refs/tags/v') &&
!github.event.pull_request.head.repo.fork &&
needs.check-gh-token.outputs.gh-token == 'true'
needs.check-gh-token.outputs.HAS_DOCKERHUB_TOKEN == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19
stable: true
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: postfinance
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: imjasonh/[email protected]
- uses: ko-build/[email protected]
name: Setup ko
env:
KO_DOCKER_REPO: docker.io/postfinance
Expand All @@ -148,13 +148,13 @@ jobs:
if: |
startsWith(github.ref, 'refs/tags/v') &&
!github.event.pull_request.head.repo.fork &&
needs.check-gh-token.outputs.gh-token == 'true'
needs.check-gh-token.outputs.HAS_DOCKERHUB_TOKEN == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19
stable: true

- name: Install Helm
Expand All @@ -163,7 +163,7 @@ jobs:
version: v3.5.0

- name: Run chart-releaser
uses: stefanprodan/helm-gh-pages@b43a8719cc63fdb3aa943cc57359ab19118eab3f #v1.5.0
uses: stefanprodan/helm-gh-pages@v1.7.0
with:
token: "${{ secrets.GITHUB_TOKEN }}"

Expand All @@ -175,21 +175,21 @@ jobs:
if: |
github.ref == 'refs/heads/main' &&
!github.event.pull_request.head.repo.fork &&
needs.check-gh-token.outputs.gh-token == 'true'
needs.check-gh-token.outputs.HAS_DOCKERHUB_TOKEN == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19
stable: true

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: postfinance
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: imjasonh/[email protected]
- uses: ko-build/[email protected]
name: Setup ko
env:
KO_DOCKER_REPO: docker.io/postfinance
Expand All @@ -207,21 +207,21 @@ jobs:
if: |
startsWith(github.ref, 'refs/heads/feat') &&
!github.event.pull_request.head.repo.fork &&
needs.check-gh-token.outputs.gh-token == 'true'
needs.check-gh-token.outputs.HAS_DOCKERHUB_TOKEN == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19
stable: true

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: postfinance
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: imjasonh/[email protected]
- uses: ko-build/[email protected]
name: Setup ko
env:
KO_DOCKER_REPO: docker.io/postfinance
Expand Down
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ linters:
- misspell
- nakedret
- prealloc
- rowserrcheck
- exportloopref
- staticcheck
- stylecheck
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/postfinance/kubelet-csr-approver

go 1.17
go 1.19

require (
github.com/foxcpp/go-mockdns v1.0.0
Expand Down
Loading

0 comments on commit c47466f

Please sign in to comment.