diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index cf2a7d9..87084cc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,141 +1,25 @@ +# filepath: .github/workflows/release.yml name: Release on: push: tags: - - "v*.*.*" # Run workflow on version tags, e.g. v1.0.0. + - 'v*' # Run workflow on version tags, e.g. v1.0.0. jobs: release: + permissions: + id-token: write + contents: write + attestations: write runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 - - name: Setup Node.js environment - uses: actions/setup-node@v4 - with: - node-version: "20.x" - - - name: Setup Go environment - uses: actions/setup-go@v5 - with: - go-version: "1.26" - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT" - - - name: Cache yarn cache - uses: actions/cache@v4 - id: cache-yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Cache node_modules - id: cache-node-modules - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-nodemodules-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-nodemodules- - - - name: Install dependencies - run: yarn install --frozen-lockfile - if: | - steps.cache-yarn-cache.outputs.cache-hit != 'true' || - steps.cache-node-modules.outputs.cache-hit != 'true' - - - name: Build and test frontend - run: yarn build - - - name: Check for backend - id: check-for-backend - run: | - if [ -f "Magefile.go" ] - then - echo "has-backend=true" >> "$GITHUB_OUTPUT" - fi - - - name: Test backend - if: steps.check-for-backend.outputs.has-backend == 'true' - uses: magefile/mage-action@v3 - with: - version: latest - args: coverage - - - name: Build backend - if: steps.check-for-backend.outputs.has-backend == 'true' - uses: magefile/mage-action@v3 + - uses: grafana/plugin-actions/build-plugin@main with: - version: latest - args: buildAll - - - name: Sign plugin - run: yarn sign - env: - GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }} # Requires a Grafana API key from Grafana.com. - - - name: Get plugin metadata - id: metadata - run: | - GRAFANA_PLUGIN_ID=$(jq -r .id dist/plugin.json) - GRAFANA_PLUGIN_VERSION=$(jq -r .info.version dist/plugin.json) - GRAFANA_PLUGIN_TYPE=$(jq -r .type dist/plugin.json) - GRAFANA_PLUGIN_ARTIFACT="${GRAFANA_PLUGIN_ID}-${GRAFANA_PLUGIN_VERSION}.zip" - GRAFANA_PLUGIN_ARTIFACT_CHECKSUM="${GRAFANA_PLUGIN_ARTIFACT}.md5" - - { - echo "plugin-id=${GRAFANA_PLUGIN_ID}" - echo "plugin-version=${GRAFANA_PLUGIN_VERSION}" - echo "plugin-type=${GRAFANA_PLUGIN_TYPE}" - echo "archive=${GRAFANA_PLUGIN_ARTIFACT}" - echo "archive-checksum=${GRAFANA_PLUGIN_ARTIFACT_CHECKSUM}" - echo "github-tag=${GITHUB_REF#refs/*/}" - } >> "$GITHUB_OUTPUT" - - - name: Read changelog - id: changelog - run: | - awk '/^## / {s++} s == 1 {print}' CHANGELOG.md > release_notes.md - echo "path=release_notes.md" >> "$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 - md5sum ${{ steps.metadata.outputs.archive }} > ${{ steps.metadata.outputs.archive-checksum }} - echo "checksum=$(cat ./${{ steps.metadata.outputs.archive-checksum }} | cut -d' ' -f1)" >> "$GITHUB_OUTPUT" - - - name: Lint plugin - run: | - git clone https://github.com/grafana/plugin-validator - pushd ./plugin-validator/pkg/cmd/plugincheck2 - go install - popd - plugincheck2 -config ./plugin-validator/config/default.yaml ${{ steps.metadata.outputs.archive }} - - - name: Create release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create "${{ steps.metadata.outputs.github-tag }}" \ - --title "Release ${{ steps.metadata.outputs.github-tag }}" \ - --notes-file "${{ steps.changelog.outputs.path }}" \ - --draft \ - "${{ steps.metadata.outputs.archive }}" \ - "${{ steps.metadata.outputs.archive-checksum }}" - - - name: Publish to Grafana.com - run: | - echo A draft release has been created for your plugin. Please review and publish it. Then submit your plugin to grafana.com/plugins by opening a PR to https://github.com/grafana/grafana-plugin-repository with the following entry: - echo - echo '{ "id": "${{ steps.metadata.outputs.plugin-id }}", "type": "${{ steps.metadata.outputs.plugin-type }}", "url": "https://github.com/${{ github.repository }}", "versions": [ { "version": "${{ steps.metadata.outputs.plugin-version }}", "commit": "${{ github.sha }}", "url": "https://github.com/${{ github.repository }}", "download": { "any": { "url": "https://github.com/${{ github.repository }}/releases/download/v${{ steps.metadata.outputs.plugin-version }}/${{ steps.metadata.outputs.archive }}", "md5": "${{ steps.package-plugin.outputs.checksum }}" } } } ] }' | jq . + # refer to https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin#generate-an-access-policy-token to generate it + # save the value in your repository secrets + policy_token: ${{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }} + attestation: true + use_changelog_generator: true # Enable automatic changelog generation \ No newline at end of file diff --git a/releases/parseable-datasource-2.0.0.sha1 b/releases/parseable-datasource-2.0.0.sha1 new file mode 100644 index 0000000..e7b505c --- /dev/null +++ b/releases/parseable-datasource-2.0.0.sha1 @@ -0,0 +1 @@ +ded3bc86057cc474aefe85b9c3e41d6bcd7cd3b6 \ No newline at end of file diff --git a/releases/parseable-datasource-2.0.0-zip b/releases/parseable-datasource-2.0.0.zip similarity index 73% rename from releases/parseable-datasource-2.0.0-zip rename to releases/parseable-datasource-2.0.0.zip index dacff5f..46da248 100644 Binary files a/releases/parseable-datasource-2.0.0-zip and b/releases/parseable-datasource-2.0.0.zip differ diff --git a/releases/parseable-datasource-2.0.0.zip.sha1 b/releases/parseable-datasource-2.0.0.zip.sha1 deleted file mode 100644 index 26da1a0..0000000 --- a/releases/parseable-datasource-2.0.0.zip.sha1 +++ /dev/null @@ -1 +0,0 @@ -62cf4fbab8d70bde83dee898ef16c8fcd8897d5a \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 031ed8e..060b184 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6908,7 +6908,7 @@ react-custom-scrollbars-2@4.5.0: prop-types "^15.5.10" raf "^3.1.0" -"react-data-grid@github:grafana/react-data-grid#a10c748f40edc538425b458af4e471a8262ec4ed": +react-data-grid@grafana/react-data-grid#a10c748f40edc538425b458af4e471a8262ec4ed: version "7.0.0-beta.56" resolved "https://codeload.github.com/grafana/react-data-grid/tar.gz/a10c748f40edc538425b458af4e471a8262ec4ed" dependencies: