-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #526 : Binary release for registry tool * Authentication shell script * Windows Batch file * Added README file for using with APIHUB
- Loading branch information
Showing
5 changed files
with
168 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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,49 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: Publish registry tool binaries | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Prepare | ||
id: prep | ||
run: | | ||
echo ::set-output name=version::${GITHUB_REF#refs/tags/} | ||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.18 | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
RELEASE_VERSION: ${{ steps.prep.outputs.version }} |
This file contains 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,48 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
builds: | ||
- id: default | ||
dir: cmd/registry | ||
main: main.go | ||
binary: registry | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
env: | ||
- CGO_ENABLED=0 | ||
ldflags: | ||
- -s -w -X "github.com/apigee/registry/cmd/registry/cmd.Version={{.Env.RELEASE_VERSION}}" | ||
|
||
archives: | ||
- id: default | ||
format: tar.gz | ||
files: | ||
- LICENSE | ||
- src: cmd/registry/APIHUB-README.md | ||
dst: . | ||
strip_parent: true | ||
- auth/HOSTED.sh | ||
- auth/HOSTED.bat | ||
builds: | ||
- default | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
release: | ||
draft: true | ||
prerelease: true |
This file contains 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,43 @@ | ||
:: | ||
:: Copyright 2022 Google LLC. All Rights Reserved. | ||
:: | ||
:: Licensed under the Apache License, Version 2.0 (the "License"); | ||
:: you may not use this file except in compliance with the License. | ||
:: You may obtain a copy of the License at | ||
:: | ||
:: http://www.apache.org/licenses/LICENSE-2.0 | ||
:: | ||
:: Unless required by applicable law or agreed to in writing, software | ||
:: distributed under the License is distributed on an "AS IS" BASIS, | ||
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
:: See the License for the specific language governing permissions and | ||
:: limitations under the License. | ||
:: | ||
|
||
|
||
:: | ||
:: Configure an environment to run Apigee Registry clients with a Google-hosted service. | ||
:: | ||
:: The following assumes you have run `gcloud auth login` and that the current | ||
:: gcloud project is the one with your Apigee Registry instance. | ||
:: | ||
|
||
WHERE gcloud >nul 2>nul | ||
IF %ERRORLEVEL% NEQ 0 ( | ||
echo 'ERROR: This script requires the gcloud command. Please install it to continue.' | ||
goto :eof | ||
) | ||
|
||
:: Calls to the hosted service are secure. | ||
set APG_REGISTRY_INSECURE= | ||
|
||
:: Get the service address. | ||
set APG_REGISTRY_AUDIENCES=https://apigeeregistry.googleapis.com | ||
set APG_REGISTRY_ADDRESS=apigeeregistry.googleapis.com:443 | ||
|
||
:: The auth token is generated for the gcloud logged-in user. | ||
FOR /F %%g IN ('gcloud config list account --format "value(core.account)"') DO set APG_REGISTRY_CLIENT_EMAIL=%%g | ||
FOR /F %%g IN ('gcloud auth print-access-token %APG_REGISTRY_CLIENT_EMAIL%') DO set APG_REGISTRY_TOKEN=%%g | ||
|
||
:: Calls don't use an API key. | ||
set APG_REGISTRY_API_KEY= |
This file contains 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,21 @@ | ||
#Registry tool | ||
|
||
To run the binary on MacOS, you will need to unquarantine the binary. | ||
> xattr -d com.apple.quarantine registry | ||
###How to use registry command with Apigee API hub instance | ||
|
||
Steps: | ||
1. Make sure you have gcloud command installed. | ||
2. Setup the GCP_PROJECT variable. | ||
3. Set you API hub project | ||
> gcloud config set project $GCP_PROJECT | ||
4. Generate the token and set it in the environment variable using | ||
> source auth/HOSTED.sh | ||
>For windows execute the `auth/HOSTED.bat` file | ||
5. To list all the APIs in your API hub instance run the below command: | ||
> registry list projects/$GCP_PROJECT/locations/global/apis/- | ||
6. Find a list of other supported commands | ||
> registry help |
This file contains 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