mirror of
https://github.com/zkitter/configs.git
synced 2026-01-07 22:23:56 -05:00
68 lines
1.9 KiB
YAML
68 lines
1.9 KiB
YAML
name: Publish packages to GitHub Packages
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
types: [closed]
|
|
branches: [main]
|
|
paths: ['packages/**']
|
|
jobs:
|
|
publish:
|
|
if: github.event.pull_request.merged == true
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# Setup .npmrc file to publish to GitHub Packages
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '16.x'
|
|
registry-url: 'https://npm.pkg.github.com'
|
|
# Defaults to the user or organization that owns the workflow file
|
|
scope: '@octocat'
|
|
|
|
- name: Configure CI Git User
|
|
run: |
|
|
git config user.name "${{ github.actor }}"
|
|
git config user.email "${{ github.actor}}@users.noreply.github.com"
|
|
|
|
- name: Import GPG key
|
|
id: import_gpg
|
|
uses: crazy-max/ghaction-import-gpg@v5
|
|
with:
|
|
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
|
git_user_signingkey: true
|
|
git_commit_gpgsign: true
|
|
|
|
- uses: pnpm/action-setup@v2.2.4
|
|
name: Install pnpm
|
|
id: pnpm-install
|
|
with:
|
|
version: 7
|
|
run_install: false
|
|
|
|
- name: Get pnpm store directory
|
|
id: pnpm-cache
|
|
shell: bash
|
|
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/cache@v3
|
|
name: Setup pnpm cache
|
|
with:
|
|
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: ${{ runner.os }}-pnpm-store-
|
|
|
|
- name: Install
|
|
run: pnpm i
|
|
|
|
- name: Publish
|
|
run: pnpm run publish
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|