mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Build and release GH action: Use vault secrets (#77448)
This commit is contained in:
parent
f7ce6f8b41
commit
da1a53ebb1
@ -17,6 +17,11 @@ env:
|
|||||||
GCP_BUCKET: integration-artifacts # Dev: plugins-community-staging
|
GCP_BUCKET: integration-artifacts # Dev: plugins-community-staging
|
||||||
GCOM_API: https://grafana.com # Dev: https://grafana-dev.com
|
GCOM_API: https://grafana.com # Dev: https://grafana-dev.com
|
||||||
|
|
||||||
|
# These permissions are needed to assume roles from Github's OIDC.
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-publish:
|
build-and-publish:
|
||||||
name: Build and publish ${{ inputs.plugin_id }}
|
name: Build and publish ${{ inputs.plugin_id }}
|
||||||
@ -31,10 +36,18 @@ jobs:
|
|||||||
- name: Verify inputs
|
- name: Verify inputs
|
||||||
run: |
|
run: |
|
||||||
if [ -z ${{ inputs.plugin_id }} ]; then echo "Missing plugin ID"; exit 1; fi
|
if [ -z ${{ inputs.plugin_id }} ]; then echo "Missing plugin ID"; exit 1; fi
|
||||||
|
- id: get-secrets
|
||||||
|
uses: grafana/shared-workflows/actions/get-vault-secrets@main
|
||||||
|
with:
|
||||||
|
# Secrets placed in the ci/repo/grafana/<repo>/<path> path in Vault
|
||||||
|
repo_secrets: |
|
||||||
|
PLUGINS_GOOGLE_CREDENTIALS=core-plugins-build-and-release:PLUGINS_GOOGLE_CREDENTIALS
|
||||||
|
PLUGINS_GRAFANA_API_KEY=core-plugins-build-and-release:PLUGINS_GRAFANA_API_KEY
|
||||||
|
PLUGINS_GCOM_TOKEN=core-plugins-build-and-release:PLUGINS_GCOM_TOKEN
|
||||||
- name: 'Authenticate to Google Cloud'
|
- name: 'Authenticate to Google Cloud'
|
||||||
uses: 'google-github-actions/auth@v1'
|
uses: 'google-github-actions/auth@v1'
|
||||||
with:
|
with:
|
||||||
credentials_json: '${{ secrets.PLUGINS_GOOGLE_CREDENTIALS }}'
|
credentials_json: '${{ env.PLUGINS_GOOGLE_CREDENTIALS }}'
|
||||||
- name: 'Set up Cloud SDK'
|
- name: 'Set up Cloud SDK'
|
||||||
uses: 'google-github-actions/setup-gcloud@v1'
|
uses: 'google-github-actions/setup-gcloud@v1'
|
||||||
- name: Setup nodejs environment
|
- name: Setup nodejs environment
|
||||||
@ -140,11 +153,11 @@ jobs:
|
|||||||
mkdir -p ci/jobs/package
|
mkdir -p ci/jobs/package
|
||||||
bin/grabpl plugin package
|
bin/grabpl plugin package
|
||||||
env:
|
env:
|
||||||
GRAFANA_API_KEY: ${{ secrets.PLUGINS_GRAFANA_API_KEY }}
|
GRAFANA_API_KEY: ${{ env.PLUGINS_GRAFANA_API_KEY }}
|
||||||
PLUGIN_SIGNATURE_TYPE: grafana
|
PLUGIN_SIGNATURE_TYPE: grafana
|
||||||
- name: Check existing release
|
- name: Check existing release
|
||||||
env:
|
env:
|
||||||
GCOM_TOKEN: ${{ secrets.PLUGINS_GCOM_TOKEN }}
|
GCOM_TOKEN: ${{ env.PLUGINS_GCOM_TOKEN }}
|
||||||
VERSION: ${{ steps.build_frontend.outputs.version }}
|
VERSION: ${{ steps.build_frontend.outputs.version }}
|
||||||
run: |
|
run: |
|
||||||
api_res=$(curl -X 'GET' -H "Authorization: Bearer $GCOM_TOKEN" \
|
api_res=$(curl -X 'GET' -H "Authorization: Bearer $GCOM_TOKEN" \
|
||||||
@ -177,7 +190,7 @@ jobs:
|
|||||||
- name: Publish new plugin version on grafana.com
|
- name: Publish new plugin version on grafana.com
|
||||||
working-directory: ${{ steps.get_dir.outputs.dir }}
|
working-directory: ${{ steps.get_dir.outputs.dir }}
|
||||||
env:
|
env:
|
||||||
GCOM_TOKEN: ${{ secrets.PLUGINS_GCOM_TOKEN }}
|
GCOM_TOKEN: ${{ env.PLUGINS_GCOM_TOKEN }}
|
||||||
VERSION: ${{ steps.build_frontend.outputs.version }}
|
VERSION: ${{ steps.build_frontend.outputs.version }}
|
||||||
run: |
|
run: |
|
||||||
echo "Publish new plugin version on grafana.com:"
|
echo "Publish new plugin version on grafana.com:"
|
||||||
|
Loading…
Reference in New Issue
Block a user