Skip to content

Commit 7d63c35

Browse files
committed
chore: set up goreleaser
Signed-off-by: Nikita B <[email protected]>
1 parent df90acc commit 7d63c35

File tree

3 files changed

+51
-210
lines changed

3 files changed

+51
-210
lines changed

.github/workflows/build-and-release-stable.yml

Lines changed: 10 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,13 @@
1-
name: Meshery Build and Releaser (stable)
1+
name: Meshsync Snapshot Build and Releaser (stable)
22
on:
33
push:
44
tags:
55
- "v*"
66

77
jobs:
8-
9-
update-rest-api-docs:
10-
name: Update REST API Documentation
11-
if: github.repository == 'meshery/meshery'
12-
runs-on: ubuntu-22.04
13-
steps:
14-
- uses: actions/checkout@v4
15-
- name: Check if handlers were modified
16-
uses: dorny/paths-filter@v3
17-
id: changes
18-
with:
19-
filters: |
20-
modified:
21-
- added|modified: "server/handlers/**"
22-
- name: Setup go-swagger
23-
if: steps.changes.outputs.modified == 'true'
24-
uses: minchao/setup-go-swagger@v1
25-
with:
26-
version: v0.30.5
27-
- name: swagger-spec
28-
if: steps.changes.outputs.modified == 'true'
29-
run: |
30-
make swagger-build
31-
- name: swagger-docs
32-
if: steps.changes.outputs.modified == 'true'
33-
run: |
34-
make swagger-docs-build
35-
36-
- name: Pull changes from remote
37-
run: git pull origin master
38-
39-
- name: Commit changes
40-
uses: stefanzweifel/git-auto-commit-action@v5
41-
with:
42-
file_pattern: docs
43-
commit_user_name: l5io
44-
commit_user_email: [email protected]
45-
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
46-
commit_options: "--signoff"
47-
commit_message: "[Docs] Updated Swagger Docs for REST API"
48-
49-
update-graphql-docs:
50-
name: Update GraphQL API Documentation
51-
if: github.repository == 'meshery/meshery'
52-
runs-on: ubuntu-22.04
53-
steps:
54-
- name: Check out code
55-
uses: actions/checkout@v4
56-
with:
57-
fetch-depth: 1
58-
- name: Check if schema was modified
59-
uses: dorny/paths-filter@v3
60-
id: filter
61-
with:
62-
filters: |
63-
modified:
64-
- added|modified: 'server/internal/graphql/schema/schema.graphql'
65-
- name: Set up Ruby
66-
if: steps.filter.outputs.modified == 'true'
67-
uses: ruby/[email protected]
68-
with:
69-
ruby-version: 3.2.2
70-
bundler-cache: true
71-
- name: graphql-docs
72-
if: steps.filter.outputs.modified == 'true'
73-
run: |
74-
cd docs; bundle install; cd ..; \
75-
make graphql-docs-build
76-
77-
- name: Pull changes from remote
78-
run: git pull origin master
79-
80-
- name: Commit changes
81-
uses: stefanzweifel/git-auto-commit-action@v5
82-
with:
83-
file_pattern: docs
84-
commit_user_name: l5io
85-
commit_user_email: [email protected]
86-
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
87-
commit_options: "--signoff"
88-
commit_message: "[Docs] Updated GraphQL API Documentation"
89-
90-
build:
91-
name: Docker build and push
92-
if: github.repository == 'meshery/meshery'
93-
env:
94-
RELEASE_CHANNEL: "stable"
95-
runs-on: ubuntu-22.04
96-
steps:
97-
- name: Check out code
98-
uses: actions/checkout@v4
99-
with:
100-
fetch-depth: 1
101-
- name: Login to DockerHub
102-
uses: docker/login-action@v3
103-
with:
104-
username: ${{ secrets.DOCKER_USERNAME }}
105-
password: ${{ secrets.DOCKER_PASSWORD }}
106-
- name: Docker stable and playground build & tag
107-
run: |
108-
DOCKER_BUILDKIT=1 docker build -f install/docker/Dockerfile --no-cache -t ${{ secrets.IMAGE_NAME }}:stable-latest --build-arg TOKEN=${{ secrets.GLOBAL_TOKEN }} --build-arg GIT_COMMITSHA=${GITHUB_SHA::8} --build-arg GIT_VERSION=${GITHUB_REF/refs\/tags\//} --build-arg RELEASE_CHANNEL=${RELEASE_CHANNEL} --build-arg PLAYGROUND=true .
109-
docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_REF/refs\/tags\//}
110-
docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_SHA::8}
111-
docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:playground-latest
112-
docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:playground-${GITHUB_REF/refs\/tags\//}
113-
docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:playground-${GITHUB_SHA::8}
114-
- name: Docker stable and playground push
115-
run: |
116-
docker push ${{ secrets.IMAGE_NAME }}:stable-latest
117-
docker push ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_REF/refs\/tags\//}
118-
docker push ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_SHA::8}
119-
docker push ${{ secrets.IMAGE_NAME }}:playground-latest
120-
docker push ${{ secrets.IMAGE_NAME }}:playground-${GITHUB_REF/refs\/tags\//}
121-
docker push ${{ secrets.IMAGE_NAME }}:playground-${GITHUB_SHA::8}
122-
# SKIP STEP: FAILS BECAUSE README FILE SIZE IS TOO LARGE FOR DOCKER HUB
123-
# - name: Docker Hub Description
124-
# uses: peter-evans/dockerhub-description@v3
125-
# env:
126-
# DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
127-
# DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
128-
# DOCKERHUB_REPOSITORY: ${{ secrets.IMAGE_NAME }}
129-
ctlrelease:
130-
name: Mesheryctl build & release
131-
if: github.repository == 'meshery/meshery' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'patch') && !contains(github.ref, 'alpha') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc')
8+
release:
9+
name: build & release
10+
if: github.repository == 'meshery-extensions/kubectl-meshsync-snapshot' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'patch') && !contains(github.ref, 'alpha') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc')
13211
runs-on: macos-latest
13312
steps:
13413
- name: Check out code
@@ -138,47 +17,19 @@ jobs:
13817
- name: Set up Go
13918
uses: actions/setup-go@master
14019
with:
141-
go-version: "1.21"
20+
go-version: "1.24"
14221
- name: goreleaser with tag
14322
uses: goreleaser/goreleaser-action@v6
14423
env:
14524
GITHUB_TOKEN: ${{ secrets.RELEASE_NOTES_PAT }}
14625
RELEASE_CHANNEL: "stable"
14726
with:
148-
version: '~> v2'
27+
version: 2
14928
args: release --clean --skip=validate
150-
- name: bump homebrew-core formula
151-
uses: mislav/bump-homebrew-formula-action@v3
152-
with:
153-
formula-name: mesheryctl
154-
download-url: https://github.com/meshery/meshery.git
155-
env:
156-
COMMITTER_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
157-
call-dde-release-workflow:
29+
email-meshsync-snaphost-release-notes-workflow:
15830
needs:
159-
- build
160-
- ctlrelease
161-
name: Build and Release Docker Extension
162-
uses: meshery/meshery/.github/workflows/build-and-release-dde.yml@master
163-
secrets: inherit
164-
call-helm-chart-releaser:
165-
needs:
166-
- build
167-
name: Release Helm Charts
168-
uses: meshery/meshery/.github/workflows/helm-chart-releaser.yml@master
169-
secrets: inherit
170-
# call-aks-playground-deploy-workflow:
171-
# needs: build
172-
# name: Deploy Meshery Playground
173-
# uses: meshery/meshery/.github/workflows/deploy-meshery-playground.yml@master
174-
# secrets: inherit
175-
email-meshery-release-notes-workflow:
176-
needs:
177-
- build
178-
- ctlrelease
179-
- call-helm-chart-releaser
180-
- call-dde-release-workflow
181-
name: Email Meshery Release Notes
31+
- release
32+
name: Email Meshsync Snapshot Release Notes
18233
uses: layer5labs/meshery-extensions-packages/.github/workflows/notify-email.yml@master
18334
secrets:
18435
token: ${{ secrets.GH_ACCESS_TOKEN }}
@@ -187,16 +38,8 @@ jobs:
18738
with:
18839
release-tag: ${{github.ref_name}}
18940
190-
call-cncf-playground-rollout:
191-
needs:
192-
- build
193-
name: Deploy CNCF Playground
194-
uses: meshery/meshery/.github/workflows/cncf-playground-deploy-meshery.yaml@master
195-
with:
196-
image: layer5/meshery:playground-${GITHUB_REF/refs\/tags\//}
197-
secrets: inherit
19841
email-on-failure:
199-
needs: [update-rest-api-docs, update-graphql-docs, build, ctlrelease, call-dde-release-workflow, call-helm-chart-releaser, email-meshery-release-notes-workflow, call-cncf-playground-rollout]
42+
needs: [release, email-meshsync-snaphost-release-notes-workflow]
20043
if: ${{ failure() }}
20144
runs-on: ubuntu-latest
20245
steps:

.goreleaser.yml

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# This is an example goreleaser.yaml file with some sane defaults.
22
# Make sure to check the documentation at http://goreleaser.com
33

4-
project_name: mesheryctl
4+
project_name: kubectl-meshsync-snapshot
5+
version: 2
56

67
before:
78
hooks:
@@ -10,15 +11,15 @@ before:
1011
# you may remove this if you don't need go generate
1112
# - go generate ./...
1213
builds:
13-
- main: ./mesheryctl/cmd/mesheryctl/main.go
14+
- main: ./cmd/meshsync/main.go
1415

1516
env:
1617
- CGO_ENABLED=0
1718

1819
ldflags:
19-
- -s -w -X github.com/layer5io/meshery/mesheryctl/internal/cli/root/constants.version={{.Tag}}
20-
- -s -w -X github.com/layer5io/meshery/mesheryctl/internal/cli/root/constants.commitsha={{.ShortCommit}}
21-
- -s -w -X github.com/layer5io/meshery/mesheryctl/internal/cli/root/constants.releasechannel={{.Env.RELEASE_CHANNEL}}
20+
- -s -w -X github.com/meshery-extensions/kubectl-meshsync-snapshot/constants.version={{.Tag}}
21+
- -s -w -X github.com/meshery-extensions/kubectl-meshsync-snapshot/constants.commitsha={{.ShortCommit}}
22+
- -s -w -X github.com/meshery-extensions/kubectl-meshsync-snapshot/constants.releasechannel={{.Env.RELEASE_CHANNEL}}
2223
# GOOS list to build for.
2324
# For more info refer to: https://golang.org/doc/install/source#environment
2425
# Defaults are darwin and linux.
@@ -66,7 +67,7 @@ archives:
6667
checksum:
6768
name_template: 'checksums.txt'
6869
snapshot:
69-
name_template: "{{ .Tag }}-next"
70+
version_template: "{{ .Tag }}-next"
7071
changelog:
7172
sort: asc
7273
filters:
@@ -100,40 +101,4 @@ release:
100101

101102
# You can change the name of the GitHub release.
102103
# Default is `{{.Tag}}`
103-
name_template: "Meshery {{.Tag}}"
104-
105-
# Extending the GoRelease to publish app manifest to scoop-bucket repository for Meshery
106-
scoops:
107-
# Template for the url which is determined by the given Token (github or gitlab)
108-
# Default for github is "https://github.com/<repo_owner>/<repo_name>/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
109-
# Default for gitlab is "https://gitlab.com/<repo_owner>/<repo_name>/uploads/{{ .ArtifactUploadHash }}/{{ .ArtifactName }}"
110-
# Gitea is not supported yet, but the support coming
111-
# url_template: "http://github.mycompany.com/foo/bar/releases/{{ .Tag }}/{{ .ArtifactName }}"
112-
113-
# Repository to push the app manifest to.
114-
- repository:
115-
owner: meshery
116-
name: scoop-bucket
117-
118-
# Git author used to commit to the repository.
119-
# Defaults are shown.
120-
commit_author:
121-
name: mesheryctl releaser
122-
123-
124-
# Your app's homepage.
125-
# Default is empty.
126-
homepage: "https://meshery.io"
127-
128-
# Your app's description.
129-
# Default is empty.
130-
description: "The Cloud Native Management Plane."
131-
132-
# Your app's license
133-
# Default is empty.
134-
license: Apache 2.0
135-
136-
# Persist data between application updates
137-
# persist:
138-
# - "data"
139-
# - "config.toml"
104+
name_template: "Kubectl Meshsync Snapshot {{.Tag}}"

constants/constants.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright Meshery Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package constants
16+
17+
var (
18+
version = "Not Set"
19+
commitsha = "Not Set"
20+
releasechannel = "Not Set"
21+
)
22+
23+
func GetVersion() string {
24+
return version
25+
}
26+
27+
func GetCommitsha() string {
28+
return commitsha
29+
}
30+
31+
func GetReleaseChannel() string {
32+
return releasechannel
33+
}

0 commit comments

Comments
 (0)