Skip to content

Commit

Permalink
chore: Improve authentification inside Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
cballevre committed Oct 16, 2024
1 parent 9f9d071 commit 6c9c420
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v4
with:
Expand All @@ -30,17 +32,19 @@ jobs:
- name: Check documentation
run: |
git diff --exit-code -- '*.md' || (echo "Docs are not up-to-date, please run yarn lint:md -f and repush" && exit 1)
- name: Configure Git
- name: Git Identity
if: github.ref == 'refs/heads/master'
run: |
git config --global user.email "[email protected]"
git config --global user.name "Cozy Bot"
- name: Publish to npm
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY
- name: NPM Identity
if: github.ref == 'refs/heads/master'
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- name: Publish to NPM
if: github.ref == 'refs/heads/master'
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
git checkout master
git remote set-url origin https://cozy-bot:[email protected]/cozy/cozy-libs.git
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
yarn lerna publish --yes -m "[skip ci] Publish"
run: yarn lerna publish --yes -m "[skip ci] Publish"

0 comments on commit 6c9c420

Please sign in to comment.