|
| 1 | +name: "(▶) Publish Alpha Version" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | +jobs: |
| 6 | + createReleasePullRequest: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + container: cypress/browsers:node12.13.0-chrome80-ff74 |
| 9 | + steps: |
| 10 | + - name: Checkout |
| 11 | + uses: actions/checkout@v2 |
| 12 | + with: |
| 13 | + fetch-depth: "0" |
| 14 | + - name: Fetch all history for all tags and branches |
| 15 | + run: git fetch |
| 16 | + - name: Setup Node.js |
| 17 | + uses: actions/setup-node@v1 |
| 18 | + with: |
| 19 | + node-version: 14 |
| 20 | + registry-url: 'https://npm.pkg.github.com' |
| 21 | + - name: Install Dependencies and Build Packages |
| 22 | + run: make init |
| 23 | + - name: Git Identity |
| 24 | + run: | |
| 25 | + git config --global user.name 'frontegg' |
| 26 | + git config --global user.email 'frontegg@users.noreply.github.com' |
| 27 | + env: |
| 28 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 29 | + - name: Authenticate with Registry |
| 30 | + run: | |
| 31 | + yarn logout |
| 32 | + echo "init-author-name=Frontegg LTD" > .npmrc |
| 33 | + echo "init-author-email=hello@frontegg.com" >> .npmrc |
| 34 | + echo "init-author-url=https://frontegg.com" >> .npmrc |
| 35 | + echo "init-license=MIT" >> .npmrc |
| 36 | + echo "always-auth=true" >> .npmrc |
| 37 | + echo "registry=https://registry.npmjs.org" >> .npmrc |
| 38 | + echo "_authToken=$NPM_TOKEN" >> .npmrc |
| 39 | + echo "@frontegg:registry=https://registry.npmjs.org" >> .npmrc |
| 40 | + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc |
| 41 | + npm whoami |
| 42 | + env: |
| 43 | + NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |
| 44 | + - name: Commit Version UP |
| 45 | + run: | |
| 46 | + yarn lerna version patch --no-git-tag-version --yes --no-push --force-publish |
| 47 | + make update-version |
| 48 | + - name: "Set Generated changelog" |
| 49 | + uses: actions/github-script@v6 |
| 50 | + id: 'generated-changelog' |
| 51 | + with: |
| 52 | + result-encoding: string |
| 53 | + script: | |
| 54 | + const { generateChangeLog } = await import(`${process.env.GITHUB_WORKSPACE}/.github/scripts/index.js`); |
| 55 | + return generateChangeLog({context, github, core}) |
| 56 | + - name: "Set incremented version" |
| 57 | + uses: actions/github-script@v6 |
| 58 | + id: 'incremented-version' |
| 59 | + with: |
| 60 | + result-encoding: string |
| 61 | + script: | |
| 62 | + const {default: fs} = await import('fs'); |
| 63 | + const {version} = JSON.parse(fs.readFileSync('./lerna.json', {encoding: "utf-8"})); |
| 64 | + return version; |
| 65 | + - name: Publish Pre-Release version to NPM |
| 66 | + id: publish_pre_release_version |
| 67 | + run: | |
| 68 | + version=$(node -p 'require("./lerna.json").version') |
| 69 | + echo "::set-output name=LIB_VERSION::${version}" |
| 70 | + echo "Publishing DEV version - v${version}-alpha.${{ github.run_id }}" |
| 71 | + make prerelease-version-upgrade-${version}-alpha.${{ github.run_id }} |
| 72 | + make publish-packages-next |
| 73 | + env: |
| 74 | + NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |
| 75 | + |
| 76 | + - name : Notify Slack on alpha version deployment |
| 77 | + uses : rtCamp/action-slack-notify@v2 |
| 78 | + env : |
| 79 | + SLACK_CHANNEL : frontegg-alpha-versions |
| 80 | + SLACK_COLOR : ${{ job.status }} |
| 81 | + SLACK_ICON : https://avatars.githubusercontent.com/u/67857107?s=40&v=4 |
| 82 | + SLACK_MESSAGE : '${{ steps.publish_pre_release_version.outputs.LIB_VERSION }}-alpha.${{ github.run_id }} has been released :rocket:' |
| 83 | + SLACK_TITLE : 'A new @frontegg/vue alpha version!' |
| 84 | + SLACK_USERNAME : ${{ github.actor }} |
| 85 | + SLACK_WEBHOOK : ${{ secrets.ROTEM_SLACK_WEBHOOK }} |
| 86 | + MSG_MINIMAL : true |
0 commit comments