Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
doregg committed Oct 26, 2023
1 parent 8eb0780 commit 2ab04ca
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 1 deletion.
88 changes: 88 additions & 0 deletions .github/workflows/publish-alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: "(▶) Publish Alpha Version"

on:
workflow_dispatch:
branches:
FR-13901-rule-based-entitlementss
jobs:
createReleasePullRequest:
runs-on: ubuntu-latest
container: cypress/browsers:node12.13.0-chrome80-ff74
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: "0"
- name: Fetch all history for all tags and branches
run: git fetch
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
registry-url: 'https://npm.pkg.github.com'
- name: Install Dependencies and Build Packages
run: make init
- 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
make update-version
- name: "Set Generated changelog"
uses: actions/github-script@v6
id: 'generated-changelog'
with:
result-encoding: string
script: |
const { generateChangeLog } = await import(`${process.env.GITHUB_WORKSPACE}/.github/scripts/index.js`);
return generateChangeLog({context, github, core})
- 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 "::set-output name=LIB_VERSION::${version}"
echo "Publishing DEV version - v${version}-alpha.${{ github.run_id }}"
make prerelease-version-upgrade-${version}-alpha.${{ github.run_id }}
make publish-packages-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/vue alpha version!'
SLACK_USERNAME : ${{ github.actor }}
SLACK_WEBHOOK : ${{ secrets.ROTEM_SLACK_WEBHOOK }}
MSG_MINIMAL : true
31 changes: 30 additions & 1 deletion .github/workflows/publish-prerelease.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: Publish Pre-Release to NPM
on:
workflow_dispatch:
# When standard Pull Request is merged
pull_request:
branches:
- master
types: [ closed ]
jobs:
createReleasePullRequest:
if: "!contains(join(github.event.pull_request.labels.*.name, ','), 'Release') && github.event.pull_request.merged == true"
runs-on: ubuntu-latest
container: cypress/browsers:node12.13.0-chrome80-ff74
steps:
Expand Down Expand Up @@ -61,13 +66,37 @@ jobs:
const {default: fs} = await import('fs');
const {version} = JSON.parse(fs.readFileSync('./lerna.json', {encoding: "utf-8"}));
return version;
- name: Commit changes
shell: bash -ex {0}
run: |
git add . && git commit -m "chore(release): publish ${{ steps.incremented-version.outputs.result }}"
- name: Create Release Pull Request
id: cpr
uses: peter-evans/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
path: ${{ secrets.GITHUB_WORKSPACE }}
commit-message: "Update v${{ steps.incremented-version.outputs.result }}"
committer: GitHub <[email protected]>
author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
title: 'v${{ steps.incremented-version.outputs.result }}'
body: |
# v${{ steps.incremented-version.outputs.result }}
${{steps.generated-changelog.outputs.result}}
labels: "Type: Release"
branch: "release/next"

- name: Publish Pre-Release version to NPM
id: publish_pre_release_version
run: |
version=$(node -p 'require("./lerna.json").version')
echo "::set-output name=LIB_VERSION::${version}"
echo "Publishing DEV version - v${version}-alpha.${{ github.run_id }}"
make prerelease-version-upgrade-${version}-alpha.${{ github.run_id }}
git add .
git commit -m "chore: prerelease version"
make publish-packages-next
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
Expand Down

0 comments on commit 2ab04ca

Please sign in to comment.