Skip to content

Commit

Permalink
FR-14827 - allow-alpha-creation-for-next-js-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvalotem1 committed Jan 9, 2024
1 parent bf3a7b2 commit 141fe82
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/publish-alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: "(▶) Publish Alpha Version"
on:
# When after commit pushed to branches not master nad release/next
push:
branches-ignore:
- 'master'
jobs:
createAlphaVersion:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: "0"
- name: Read .nvmrc
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvm
- name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }}
uses: actions/setup-node@v2
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- name: Install Dependencies and Build Packages
run: |
yarn install
yarn build
- name: Git Identity
run: |
git config --global user.name 'frontegg'
git config --global user.email '[email protected]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Authenticate with Registry
run: |
yarn logout
echo "init-author-name=Frontegg LTD" > .npmrc
echo "[email protected]" >> .npmrc
echo "init-author-url=https://frontegg.com" >> .npmrc
echo "init-license=MIT" >> .npmrc
echo "always-auth=true" >> .npmrc
echo "registry=https://registry.npmjs.org" >> .npmrc
echo "_authToken=$NPM_TOKEN" >> .npmrc
echo "@frontegg:registry=https://registry.npmjs.org" >> .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm whoami
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Commit Version UP
run: |
yarn lerna version patch --no-git-tag-version --yes --no-push --force-publish
yarn update-version
yarn prettier
- name: "Set incremented version"
uses: actions/github-script@v6
id: 'incremented-version'
with:
result-encoding: string
script: |
const {default: fs} = await import('fs');
const {version} = JSON.parse(fs.readFileSync('./lerna.json', {encoding: "utf-8"}));
return version;
- name: Publish Pre-Release version to NPM
id: publish_pre_release_version
run: |
version=$(node -p 'require("./lerna.json").version')
echo "LIB_VERSION=${version}" >> $GITHUB_OUTPUT
echo "Publishing DEV version - v${version}-alpha.${{ github.run_id }}"
alphaVersion="${version}-alpha.${{ github.run_id }}"
yarn lerna version --no-git-tag-version --yes --no-push --exact "${alphaVersion}"
yarn update-version
yarn build
cp "./.npmrc" "./dist/@frontegg/nextjs/.npmrc"
cp "./.npmignore" "./dist/@frontegg/nextjs/.npmignore"
cd "./dist/@frontegg/nextjs" && npm publish --tag next
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Notify Slack on alpha version deployment
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: frontegg-alpha-versions
SLACK_COLOR: ${{ job.status }}
SLACK_ICON: https://avatars.githubusercontent.com/u/67857107?s=40&v=4
SLACK_MESSAGE: '${{ steps.publish_pre_release_version.outputs.LIB_VERSION }}-alpha.${{ github.run_id }} has been released :rocket:'
SLACK_TITLE: 'A new @frontegg/nextjs alpha version!'
SLACK_USERNAME: ${{ github.actor }}
SLACK_WEBHOOK: ${{ secrets.ROTEM_SLACK_WEBHOOK }}
MSG_MINIMAL: true

0 comments on commit 141fe82

Please sign in to comment.