Skip to content

Commit

Permalink
Do not add something on the fly to .npmrc to have a clean git state
Browse files Browse the repository at this point in the history
  • Loading branch information
JensDallmann committed Sep 10, 2021
1 parent 7522d84 commit ca29932
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/feature-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
runs-on: ubuntu-latest
# do not run when if it is a manual trigger on the main branch as we have other CI for this. This one is only for feature branches
if: github.event_name != 'workflow_dispatch' || github.ref != 'refs/heads/main'
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
NPM_CONFIG_@coremedia:registry: 'https://npm.coremedia.io'
NPM_CONFIG_//npm.coremedia.io/:_authToken: ${NPM_AUTH_TOKEN}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -27,20 +31,14 @@ jobs:
with:
node-version: 14.x
- name: Configure NPM
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
npm install -g pnpm@6.14.6
npm install -g semver
npm config set @coremedia:registry=https://npm.coremedia.io
echo '//npm.coremedia.io/:_authToken=${NPM_AUTH_TOKEN}' > .npmrc
- name: Setup Git
run: |
git config --global user.name 'coremedia-ci'
git config --global user.email 'coremedia-ci@coremedia.com'
- name: Install
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: pnpm install
- name: Set prerelease version (if triggered manually)
if: github.event_name == 'workflow_dispatch'
Expand All @@ -61,8 +59,6 @@ jobs:
run: pnpm jest
- name: Publish prerelease
if: github.event_name == 'workflow_dispatch'
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
pnpm install --production
pnpm publishall --no-git-checks
Expand Down
18 changes: 4 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
jobs:
build:
name: Build
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
NPM_CONFIG_@coremedia:registry: 'https://npm.coremedia.io'
NPM_CONFIG_//npm.coremedia.io/:_authToken: ${NPM_AUTH_TOKEN}
runs-on: ubuntu-latest
if: github.actor != 'coremedia-ci' && github.actor != 'github-action[bot]'
steps:
Expand All @@ -34,27 +38,19 @@ jobs:
with:
node-version: 14.x
- name: Configure NPM
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
npm install -g pnpm@6.14.6
npm install -g semver
npm config set @coremedia:registry=https://npm.coremedia.io
echo '//npm.coremedia.io/:_authToken=${NPM_AUTH_TOKEN}' > .npmrc
- name: Setup Git
run: |
git config --global user.name 'coremedia-ci'
git config --global user.email 'coremedia-ci@coremedia.com'
- name: Install
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: pnpm install
# ON MAIN BY MANUAL TRIGGER ONLY!
# Set the release version to actual MAJOR.MINOR.PATCH version.
# If a prerelease is triggered manually, we keep the prerelease version for this workflow.
- name: Create Release Version
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
run: |
git stash
Expand Down Expand Up @@ -87,21 +83,15 @@ jobs:
- name: Test
run: pnpm jest
- name: Install for Production
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: pnpm install --production
- name: Publish
if: github.ref == 'refs/heads/main'
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
pnpm publishall --no-git-checks
# MAIN ONLY
# Set next prerelease version to prepare for next build.
# This ensures that we do not build one release number twice (for not getting conflicts in our repository)
- name: Create Next Prerelease Version
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
if: github.ref == 'refs/heads/main'
# Make sure to not commit anything which has been changed in one of the previous steps.
# Update the version, afterwards commit and push.
Expand Down

0 comments on commit ca29932

Please sign in to comment.