Skip to content

Commit d5384bd

Browse files
committed
Remove goreleaser and fix helm packaging
1 parent 3716e5d commit d5384bd

File tree

15 files changed

+60
-168
lines changed

15 files changed

+60
-168
lines changed

.github/workflows/docker.yml

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@ on:
88
- main
99
pull_request:
1010

11-
env:
12-
GORELEASER_VER: "v2.3.2"
13-
1411
jobs:
1512
release:
16-
env:
17-
flags: ""
1813
runs-on: ubuntu-latest
1914
permissions:
2015
contents: read
@@ -24,51 +19,42 @@ jobs:
2419
id-token: write
2520

2621
steps:
27-
- name: Parse semver string
28-
id: semver_parser
29-
uses: booxmedialtd/ws-action-parse-semver@v1
22+
- name: Docker meta
23+
id: meta
24+
uses: docker/metadata-action@v5
3025
with:
31-
input_string: ${{ (startsWith(github.ref, 'refs/tags/v') && github.ref) || 'refs/tags/v0.0.0' }}
32-
version_extractor_regex: '\/v(.*)$'
33-
34-
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
35-
run: echo "flags=--snapshot" >> $GITHUB_ENV
36-
37-
- name: Checkout repository
38-
uses: actions/checkout@v4
39-
with:
40-
fetch-depth: 0 # It is required for GoReleaser to work properly
41-
42-
- name: Install modules
43-
run: go mod tidy
44-
45-
- name: check git status
46-
run: git --no-pager diff --exit-code
47-
# Set up BuildKit Docker container builder to be able to build
48-
# multi-platform images and export cache
49-
# https://github.com/docker/setup-buildx-action
50-
- name: Set up Docker Buildx
51-
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
52-
53-
# Login against a Docker registry except on PR
54-
# https://github.com/docker/login-action
55-
- name: Login to Docker hub
26+
# list of Docker images to use as base name for tags
27+
images: |
28+
netbirdio/kubernetes-operator
29+
# generate Docker tags based on the following events/attributes
30+
tags: |
31+
type=ref,event=pr
32+
type=ref,event=branch
33+
type=semver,pattern={{version}}
34+
35+
- name: Login to Docker Hub
5636
if: github.repository == github.event.pull_request.head.repo.full_name || !github.head_ref
57-
uses: docker/login-action@v1
37+
uses: docker/login-action@v3
5838
with:
5939
username: ${{ secrets.DOCKER_USER }}
6040
password: ${{ secrets.DOCKER_TOKEN }}
6141

62-
- name: Install OS build dependencies
63-
run: sudo apt update && sudo apt install -y -q gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu
42+
- name: Set up QEMU
43+
uses: docker/setup-qemu-action@v3
44+
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
6447

65-
- name: Install goversioninfo
66-
run: go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@233067e
67-
68-
- name: Run GoReleaser
69-
uses: goreleaser/goreleaser-action@v4
48+
- name: Build and push
49+
uses: docker/build-push-action@v6
7050
with:
71-
version: ${{ env.GORELEASER_VER }}
72-
args: release --clean ${{ env.flags }}
73-
env:
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
platforms: linux/amd64,linux/arm64
52+
push: true
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: |
55+
"org.opencontainers.image.created={{.Date}}"
56+
"org.opencontainers.image.title={{.ProjectName}}"
57+
"org.opencontainers.image.version={{.Version}}"
58+
"org.opencontainers.image.revision={{.FullCommit}}"
59+
"org.opencontainers.image.version={{.Version}}"
60+

.github/workflows/helm.yml

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,49 +18,25 @@ jobs:
1818
contents: write
1919
pages: write
2020
steps:
21-
- name: Checkout repository
22-
uses: actions/checkout@v4
21+
- name: Checkout
22+
uses: actions/checkout@v3.1.0
2323
with:
2424
fetch-depth: 0
2525

26-
- name: Set ENVs
27-
id: env-setup
26+
- name: Configure Git
2827
run: |
29-
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
3028
git config user.name "$GITHUB_ACTOR"
3129
git config user.email "[email protected]"
3230
33-
- name: Package Charts
34-
run: |
35-
# Package charts
36-
mkdir -p charts/.ci-build
37-
echo "Setting chart version to ${{ steps.env-setup.outputs.CHART_VERSION }}"
38-
39-
for DIR in $CHART_BASE_DIR/*; do
40-
# Check if Chart.yaml exists in this directory
41-
if [ -f "${DIR}/Chart.yaml" ]; then
42-
echo "Packaging ${DIR}"
43-
helm dependency update $DIR
44-
helm lint $DIR
45-
helm package $DIR --destination charts/.ci-build
46-
fi
47-
done
48-
git fetch --all
49-
50-
- name: Upload chart artifacts
51-
uses: actions/upload-artifact@v4
31+
- name: Install Helm
32+
uses: azure/[email protected]
5233
with:
53-
name: helm-charts-${{ github.ref_name }}
54-
path: charts/.ci-build/*
55-
retention-days: 30
34+
version: v3.4.2
5635

57-
- name: Publish to GH-Pages
58-
id: ghpublish
59-
run: |
60-
git checkout $GH_PAGES_BRANCH --force
61-
helm repo index charts/.ci-build/ --merge index.yaml --url ${{ github.server_url }}/${{github.repository}}/releases/download/${{ github.ref_name }}
62-
cp charts/.ci-build/index.yaml index.yaml
63-
echo "New index:" && cat index.yaml
64-
git add index.yaml charts
65-
git commit -a -m "bot: update pages index for helm charts"
66-
git push origin $GH_PAGES_BRANCH
36+
- name: Run chart-releaser
37+
uses: helm/[email protected]
38+
with:
39+
charts_dir: helm
40+
env:
41+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
42+
CR_RELEASE_NAME_TEMPLATE: "helm-v{{ .Version }}"

.goreleaser.yaml

Lines changed: 0 additions & 86 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
netbirdAPI:
2+
key: "nbp_1TpgsCUaF2BU3NVZfaDrGpoY1jx2iT2g7rWj"
3+
4+
operator:
5+
image:
6+
tag: "v0.1.0"
7+
8+
ingress:
9+
enabled: true
10+
router:
11+
enabled: true
12+
policies:
13+
default:
14+
name: Kubernetes Default Policy
15+
sourceGroups:
16+
- All

0 commit comments

Comments
 (0)