meta(changelog): Update package versions (#188) #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "**/CHANGELOG.md" | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
# For whatever reason, yaml does not like the full "meta(changelog): Update package versions" string | |
# So we check this in two parts | |
if: | | |
contains(github.event.head_commit.message, 'meta(changelog)') | |
&& contains(github.event.head_commit.message, 'Update package versions') | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: "package.json" | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Cache node_modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-codecov-js-bundle-plugin-node-modules | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-${{ env.cache-name }}- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Publish to NPM | |
uses: changesets/action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
with: | |
publish: pnpm changeset:publish | |
createGithubReleases: true | |
publish_docs: | |
name: Publish Docs | |
needs: publish | |
runs-on: ubuntu-latest | |
# For whatever reason, yaml does not like the full "meta(changelog): Update package versions" string | |
# So we check this in two parts | |
if: | | |
contains(github.event.head_commit.message, 'meta(changelog)') | |
&& contains(github.event.head_commit.message, 'Update package versions') | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Import GPG key | |
id: import-gpg | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.RELEASER_GPG_PRIVATE_KEY }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
git_config_global: true | |
- name: Setup Git | |
run: | | |
echo "machine github.com login x password ${{ secrets.GITHUB_TOKEN }}" > ~/.netrc | |
git config --global url."https://github.com/".insteadOf "git://github.com/" | |
git config --global advice.detachedHead false | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: "package.json" | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Cache node_modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-codecov-js-bundle-plugin-node-modules | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-${{ env.cache-name }}- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Publish new docs | |
run: node scripts/publish-docs.mjs |