chore(release-pkg): release packages #1269
Workflow file for this run
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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
# Workflow syntax for GitHub Actions | |
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions | |
# Context and expression syntax for GitHub Actions | |
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions | |
name: Publish NPM Packages | |
on: | |
pull_request: | |
branches: | |
- dev | |
types: | |
- closed | |
jobs: | |
release-pkg: | |
if: ${{ github.event.pull_request.merged == true && github.head_ref != '__release-pkg' }} | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
node-version: [16.14] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# to trigger next gh action | |
# https://git.luolix.topmunity/t/push-from-action-even-with-pat-does-not-trigger-action/17622/6 | |
persist-credentials: false | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
cache: "yarn" | |
node-version: ${{ matrix.node-version }} | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: "adopt" | |
java-version: "11" | |
- name: Install clojure tools | |
uses: DeLaGuardo/setup-clojure@7.0 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
cli: latest | |
bb: latest | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | |
- uses: actions/cache@v3 | |
id: yarn-and-maven-cache # use this to check for `cache-hit` (`steps.yarn-and-maven-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: | | |
~/.m2/repository | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
./.shadow-cljs | |
key: ${{ runner.os }}-yarn-and-maven-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('./shadow-cljs.edn') }}-${{ hashFiles('./deps.edn') }} | |
restore-keys: | | |
${{ runner.os }}-yarn-and-maven- | |
- run: yarn install --immutable | |
- run: yarn version apply --all || true | |
- run: rm -rf .yarn/versions || true | |
- env: | |
YARN_NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
run: ./scripts/any-packages-version-changed.sh && yarn workspaces foreach --topological --no-private --verbose --parallel --interlaced npm publish --access public --tolerate-republish || true | |
- run: git add . | |
- run: | | |
git -c user.name='ConfluxBot' \ | |
-c user.email='confluxbot@users.noreply.github.com' \ | |
commit \ | |
--no-verify \ | |
--message 'chore(common): release packages' || true | |
- env: | |
GH_TOKEN: ${{ secrets.CONFLUX_BOT_GH_TOKEN }} | |
run: git push --force --verbose "https://ConfluxBot:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}" HEAD:refs/heads/__release-pkg | |
- env: | |
GITHUB_TOKEN: ${{secrets.CONFLUX_BOT_GH_TOKEN}} | |
run: ./scripts/create-pkg-release-pr |