diff --git a/.github/actions/pnpm/action.yml b/.github/actions/pnpm/action.yml new file mode 100644 index 0000000..37770c1 --- /dev/null +++ b/.github/actions/pnpm/action.yml @@ -0,0 +1,32 @@ +name: 'Setup pnpm' +description: 'Sets up pnpm for use in other actions' + +runs: + using: 'composite' + steps: + - uses: actions/checkout@v4 + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: 8.6.2 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install --frozen-lockfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ce37e7..e184f2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,32 +27,7 @@ jobs: GRAFANA_ACCESS_POLICY_TOKEN: ${{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }} steps: - uses: actions/checkout@v4 - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: 8.6.2 - run_install: false - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: pnpm install --frozen-lockfile + - uses: ./.github/actions/pnpm - name: Check types run: pnpm run typecheck diff --git a/.github/workflows/is-compatible.yml b/.github/workflows/is-compatible.yml index 65ab507..be06abc 100644 --- a/.github/workflows/is-compatible.yml +++ b/.github/workflows/is-compatible.yml @@ -10,31 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - - uses: pnpm/action-setup@v4 - name: Install pnpm - with: - version: 8.6.2 - run_install: false - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: pnpm install --frozen-lockfile + - uses: ./.github/actions/pnpm - name: Build plugin run: pnpm run build - name: Compatibility check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 523ba64..d2fd724 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,11 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/pnpm - uses: grafana/plugin-actions/build-plugin@release - # Uncomment to enable plugin signing - # (For more info on how to generate the access policy token see https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin#generate-an-access-policy-token) - #with: - # Make sure to save the token in your repository secrets - #policy_token: $ - # Usage of GRAFANA_API_KEY is deprecated, prefer `policy_token` option above - #grafana_token: $ + with: + policy_token: ${{ secrets.GRAFANA_POLICY_TOKEN }}