Skip to content

Commit

Permalink
add archive option to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
briangann committed Jan 22, 2024
1 parent c4c56e6 commit c80d680
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
GRAFANA_ACCESS_POLICY_TOKEN: ${{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }}
steps:
- uses: actions/checkout@v3
# pnpm action uses the packageManager field in package.json to
Expand Down Expand Up @@ -91,6 +93,47 @@ jobs:
path: cypress/videos
retention-days: 5

- name: Warn missing Grafana access policy token
run: |
echo Please generate a Grafana access policy token: https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin#generate-an-access-policy-token
echo Once done please follow the instructions found here: https://github.com/${{github.repository}}/blob/main/README.md#using-github-actions-release-workflow
if: ${{ env.GRAFANA_ACCESS_POLICY_TOKEN == '' }}

- name: Sign plugin
run: pnpm run sign
if: ${{ env.GRAFANA_ACCESS_POLICY_TOKEN != '' }}

- name: Get plugin metadata
id: metadata
run: |
sudo apt-get install jq
export GRAFANA_PLUGIN_ID=$(cat dist/plugin.json | jq -r .id)
export GRAFANA_PLUGIN_VERSION=$(cat dist/plugin.json | jq -r .info.version)
export GRAFANA_PLUGIN_ARTIFACT=${GRAFANA_PLUGIN_ID}-${GRAFANA_PLUGIN_VERSION}.zip
echo "plugin-id=${GRAFANA_PLUGIN_ID}" >> $GITHUB_OUTPUT
echo "plugin-version=${GRAFANA_PLUGIN_VERSION}" >> $GITHUB_OUTPUT
echo "archive=${GRAFANA_PLUGIN_ARTIFACT}" >> $GITHUB_OUTPUT
echo "github-tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Check package version
run: if [ "v${{ steps.metadata.outputs.plugin-version }}" != "${{ steps.metadata.outputs.github-tag }}" ]; then printf "\033[0;31mPlugin version doesn't match tag name\033[0m\n"; exit 1; fi

- name: Package plugin
id: package-plugin
run: |
mv dist ${{ steps.metadata.outputs.plugin-id }}
zip ${{ steps.metadata.outputs.archive }} ${{ steps.metadata.outputs.plugin-id }} -r
- name: Archive Build
uses: actions/upload-artifact@v3
with:
name: build
path: ${{ steps.metadata.outputs.archive }}
retention-days: 5

- name: Code Climate - Check environment
id: check-for-codeclimate
env:
Expand Down

0 comments on commit c80d680

Please sign in to comment.