ci: swapping npx for yarn in publish workflow #2
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: | |
workflow_call: | |
push: | |
branches: | |
- main | |
- develop | |
jobs: | |
lint-test-build: | |
uses: ./.github/workflows/lint-test-build.yml | |
setup: | |
needs: [lint-test-build] | |
runs-on: ubuntu-latest | |
outputs: | |
postfix: ${{ env.postfix }} | |
gitsha: ${{ steps.gitsha.outputs.value }} | |
steps: | |
# # Setup Auth token to push to github packages | |
- name: Set NPM Config | |
run: npm config set '//npm.pkg.github.com/:_authToken' '${{ secrets.ACCESS_TOKEN }}' | |
- name: Add safe directory | |
run: git config --global --add safe.directory /__w/sage-lib/sage-lib | |
- name: Clone Sage-Lib Repo | |
uses: actions/checkout@v4 | |
with: | |
# pulls all commits (needed for lerna / semantic release to correctly version) | |
fetch-depth: "0" | |
# Setup Git Credentials to come from the Bot | |
- name: Set Bot Email | |
run: git config user.email "[email protected]" | |
- name: Set Bot Name | |
run: git config user.name "Kajabi Automation Bot" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
with: | |
version: v0.9.1 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '2.7.7' | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: https://npm.pkg.github.com | |
- name: Determine git sha to checkout | |
uses: haya14busa/action-cond@v1 | |
id: gitsha | |
with: | |
cond: ${{ github.event_name == 'pull_request' }} | |
if_true: ${{ github.event.pull_request.head.sha }} | |
if_false: ${{ github.sha }} | |
# Envs based on the current branch | |
- name: Branch Env | |
id: branch_env | |
run: | | |
echo "Running on branch " | |
if [ "${{ github.ref }}" == "refs/heads/develop" ]; then | |
echo "postfix=staging" >> $GITHUB_ENV | |
elif [ "${{ github.ref }}" == "refs/heads/main" ]; then | |
echo "postfix=production" >> $GITHUB_ENV | |
else | |
echo "postfix=staging" >> $GITHUB_ENV | |
fi | |
publish: | |
needs: [setup] | |
name: Publish Packages | |
runs-on: ubuntu-latest | |
if: needs.setup.outputs.postfix == 'production' # Only create package on `main` | |
steps: | |
- name: Lerna Boostrap | |
run: yarn lerna bootstrap --ci | |
- name: Lerna Publish | |
run: NODE_OPTIONS=--openssl-legacy-provider yarn lerna publish --registry github --yes | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.ACCESS_TOKEN }} |