👷Add publish workflow (#1)

* 👷Add publish workflow

* Update workflow

* new line
This commit is contained in:
r1oga
2022-12-17 12:16:46 +01:00
committed by GitHub
parent 5daaaa7fd1
commit 88110d46f4
2 changed files with 68 additions and 1 deletions

67
.github/workflows/publish.yaml vendored Normal file
View File

@@ -0,0 +1,67 @@
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 ci
- name: Publish
run: pnpm run publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -6,7 +6,7 @@
"private": true,
"scripts": {
"clean": "rm -rf node_modules && lerna clean",
"publish": "lerna publish --no-private"
"publish": "lerna publish -y --no-private --pre-id ci --npm-tag=ci --force-publish=* --registry '@r1oga:registry=https://npm.pkg.github.com' --message ':package: Publish'"
},
"devDependencies": {
"lerna": "^6.1.0"