-
Notifications
You must be signed in to change notification settings - Fork 0
build: add release and release dry run pipeline #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
84cb86a
build: add release and release dry run pipeline
idebeijer 91e1038
build: remove ghcr login for dry run release
idebeijer 8a19a88
build: add helm chart
idebeijer 7bc7a33
build: add job to publish chart
idebeijer 962c885
build: edit entrypoint in dockerfile
idebeijer f1e6b1b
build: remove some labels from docker build
idebeijer 0724532
build: use exported variables for ldflags
idebeijer 0de033e
build: give goreleaser release job write access
idebeijer a1f7a23
build: use azure/setup-helm action to install helm
idebeijer 39da245
build: fix github ref in release
idebeijer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: GoReleaser Snapshot Release (dry run) | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| goreleaser: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Run GoReleaser | ||
| uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| distribution: goreleaser | ||
| version: "~> v2" | ||
| args: release --clean --snapshot | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" | ||
|
|
||
| permissions: | ||
| contents: write | ||
| packages: write | ||
|
|
||
| jobs: | ||
| goreleaser: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to GitHub Container Registry (GHCR) | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: docker.io | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: "go.mod" | ||
|
|
||
| - name: Run GoReleaser | ||
| uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| distribution: goreleaser | ||
| version: "~> v2" | ||
| args: release --clean | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| helm: | ||
| runs-on: ubuntu-latest | ||
| needs: goreleaser | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Set up Helm | ||
| uses: azure/setup-helm@v4 | ||
|
|
||
| - name: Package Helm chart | ||
| run: | | ||
| # get tag and strip leading 'v' if present | ||
| TAG="${{ github.ref_name }}" | ||
| CLEAN_TAG=${TAG#v} | ||
| echo "Packaging chart with version/appVersion=${CLEAN_TAG}" | ||
| mkdir -p dist | ||
| helm package ./dist/chart --destination ./dist/chartrelease --version "${CLEAN_TAG}" --app-version "${CLEAN_TAG}" | ||
|
idebeijer marked this conversation as resolved.
|
||
|
|
||
| - name: Login to GHCR (GitHub Container Registry) | ||
| run: | | ||
| echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io --username "${{ github.actor }}" --password-stdin | ||
|
|
||
| - name: Push chart to GHCR (OCI) | ||
| run: | | ||
| CHART_TGZ=$(ls ./dist/chartrelease/*.tgz | head -n1) | ||
| echo "pushing $CHART_TGZ to ghcr.io/${{ github.repository_owner }}/charts" | ||
| helm push "$CHART_TGZ" oci://ghcr.io/${{ github.repository_owner }}/charts | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| name: Test Chart | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| test-e2e: | ||
| name: Run on Ubuntu | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Clone the code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
|
|
||
| - name: Install the latest version of kind | ||
| run: | | ||
| curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64 | ||
| chmod +x ./kind | ||
| sudo mv ./kind /usr/local/bin/kind | ||
|
|
||
| - name: Verify kind installation | ||
| run: kind version | ||
|
|
||
| - name: Create kind cluster | ||
| run: kind create cluster | ||
|
|
||
| - name: Prepare gameserver-operator | ||
| run: | | ||
| go mod tidy | ||
| make docker-build IMG=gameserver-operator:v0.1.0 | ||
| kind load docker-image gameserver-operator:v0.1.0 | ||
|
|
||
| - name: Setup Helm | ||
| uses: azure/setup-helm@v4 | ||
| with: | ||
| version: v3.14.4 | ||
| - name: Verify Helm installation | ||
| run: helm version | ||
|
|
||
| - name: Lint Helm Chart | ||
| run: | | ||
| helm lint ./dist/chart | ||
|
idebeijer marked this conversation as resolved.
|
||
|
|
||
| # TODO: Uncomment if cert-manager is enabled | ||
| # - name: Install cert-manager via Helm | ||
| # run: | | ||
| # helm repo add jetstack https://charts.jetstack.io | ||
| # helm repo update | ||
| # helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set crds.enabled=true | ||
| # | ||
| # - name: Wait for cert-manager to be ready | ||
| # run: | | ||
| # kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager | ||
| # kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-cainjector | ||
| # kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook | ||
|
|
||
| # TODO: Uncomment if Prometheus is enabled | ||
| # - name: Install Prometheus Operator CRDs | ||
| # run: | | ||
| # helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | ||
| # helm repo update | ||
| # helm install prometheus-crds prometheus-community/prometheus-operator-crds | ||
| # | ||
| # - name: Install Prometheus via Helm | ||
| # run: | | ||
| # helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | ||
| # helm repo update | ||
| # helm install prometheus prometheus-community/prometheus --namespace monitoring --create-namespace | ||
| # | ||
| # - name: Wait for Prometheus to be ready | ||
| # run: | | ||
| # kubectl wait --namespace monitoring --for=condition=available --timeout=300s deployment/prometheus-server | ||
|
|
||
| - name: Install Helm chart for project | ||
| run: | | ||
| helm install my-release ./dist/chart --create-namespace --namespace gameserver-operator-system | ||
|
idebeijer marked this conversation as resolved.
|
||
|
|
||
| - name: Check Helm release status | ||
| run: | | ||
| helm status my-release --namespace gameserver-operator-system | ||
|
|
||
| # TODO: Uncomment if prometheus.enabled is set to true to confirm that the ServiceMonitor gets created | ||
| # - name: Check Presence of ServiceMonitor | ||
| # run: | | ||
| # kubectl wait --namespace gameserver-operator-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/gameserver-operator-controller-manager-metrics-monitor | ||
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/goreleaser/goreleaser/v2.12.5/www/docs/static/schema.json | ||
|
|
||
| version: 2 | ||
|
|
||
| dist: dist/goreleaser | ||
|
|
||
| builds: | ||
| - id: manager | ||
| main: cmd/main.go | ||
| binary: manager | ||
| goos: | ||
| - linux | ||
| goarch: | ||
| - amd64 | ||
| - arm64 | ||
| env: | ||
| - CGO_ENABLED=0 | ||
| ldflags: | ||
| - "-s" | ||
| - "-w" | ||
| - "-X github.com/idebeijer/gameserver-operator/pkg/version.Version={{ .Version }}" | ||
| - "-X github.com/idebeijer/gameserver-operator/pkg/version.Commit={{ .ShortCommit }}" | ||
| - "-X github.com/idebeijer/gameserver-operator/pkg/version.Date={{ .Date }}" | ||
| - "-X github.com/idebeijer/gameserver-operator/pkg/version.BuiltBy=goreleaser" | ||
|
|
||
| dockers_v2: | ||
| - dockerfile: Dockerfile.goreleaser | ||
| ids: | ||
| - manager | ||
| images: | ||
| - "ghcr.io/idebeijer/gameserver-operator" | ||
| - "docker.io/idebeijer/gameserver-operator" | ||
| tags: | ||
| - "{{ .Version }}" | ||
| labels: | ||
| "org.opencontainers.image.created": "{{ .Date }}" | ||
| "org.opencontainers.image.url": "https://github.com/idebeijer/gameserver-operator" | ||
| "org.opencontainers.image.documentation": "https://github.com/idebeijer/gameserver-operator/blob/main/README.md" | ||
| "org.opencontainers.image.source": "{{ .GitURL }}" | ||
| "org.opencontainers.image.version": "{{ .Version }}" | ||
| "org.opencontainers.image.revision": "{{ .FullCommit }}" | ||
| "org.opencontainers.image.licenses": "MIT" | ||
| "org.opencontainers.image.title": "{{ .ProjectName }}" | ||
| "org.opencontainers.image.description": "Kubernetes operator for managing game servers" | ||
| platforms: | ||
| - linux/amd64 | ||
| - linux/arm64 | ||
|
idebeijer marked this conversation as resolved.
|
||
|
|
||
| snapshot: | ||
| version_template: "{{ incpatch .Version }}" | ||
|
|
||
| release: | ||
| footer: | | ||
| **Full Changelog**: https://github.com/idebeijer/gameserver-operator/compare/{{ .PreviousTag }}...{{ .Tag }} | ||
|
|
||
| changelog: | ||
| sort: asc | ||
| use: github | ||
| groups: | ||
| - title: "Breaking changes" | ||
| regexp: '^.*?\w+(\(.+\))?!:\s?.+$' | ||
| order: 0 | ||
| - title: "Features" | ||
| regexp: '^.*?feat(\(.+\))??!?:.+$' | ||
| order: 1 | ||
| - title: "Bug fixes" | ||
| regexp: '^.*?fix(\(.+\))??!?:.+$' | ||
| order: 2 | ||
| - title: "Documentation" | ||
| regexp: '^.*?docs(\(.+\))??!?:.+$' | ||
| order: 3 | ||
| - title: "Build system" | ||
| regexp: '^.*?(build|ci)(\(.+\))??!?:.+$' | ||
| order: 4 | ||
| - title: "Others" | ||
| order: 999 | ||
| filters: | ||
| exclude: | ||
| - '^.*?(test|style)(\(.+\))??!?:.+$' | ||
| - 'initial commit' | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| FROM gcr.io/distroless/static:nonroot AS runtime | ||
| ARG TARGETPLATFORM | ||
|
|
||
| COPY --chown=65532:65532 ${TARGETPLATFORM}/manager /usr/local/bin/manager | ||
| WORKDIR /home/nonroot | ||
| USER 65532:65532 | ||
|
|
||
| ENTRYPOINT ["/usr/local/bin/manager"] |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Patterns to ignore when building Helm packages. | ||
| # Operating system files | ||
| .DS_Store | ||
|
|
||
| # Version control directories | ||
| .git/ | ||
| .gitignore | ||
| .bzr/ | ||
| .hg/ | ||
| .hgignore | ||
| .svn/ | ||
|
|
||
| # Backup and temporary files | ||
| *.swp | ||
| *.tmp | ||
| *.bak | ||
| *.orig | ||
| *~ | ||
|
|
||
| # IDE and editor-related files | ||
| .idea/ | ||
| .vscode/ | ||
|
|
||
| # Helm chart artifacts | ||
| dist/chart/*.tgz |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| apiVersion: v2 | ||
| name: gameserver-operator | ||
| description: A Helm chart to distribute the project gameserver-operator | ||
| type: application | ||
| version: 0.1.0 | ||
| appVersion: "0.1.0" | ||
| icon: "https://example.com/icon.png" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.