Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

generate-alpha-command #449

generate-alpha-command

generate-alpha-command #449

Workflow file for this run

name: NPM Alpha Publish Release Workflow
on:
workflow_dispatch:
repository_dispatch:
types: [generate-alpha-command]
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
# Get yarn cache directory and set it in a variable
- name: Get yarn cache path
id: yarn-cache-path
run: echo "::set-output name=dir::$(yarn cache dir)"
# Checkout branch or head commit
- name: Checkout branch
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge"
# Set up node version
- name: Setup Node js version
uses: actions/setup-node@v2
with:
node-version: 16.x
# Load yarn cache
- name: Load Yarn cache
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Install the dependencies
- name: Install dependencies
run: yarn install --frozen-lockfile
# Set git config -> changelog
- name: Set git config to github-actions
run: |
git config user.name github-actions
git config user.email [email protected]
# Configure npm
- name: Configure npm
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.APPSMITH_NPM_PUBLISH_KEY }}
# Build packages, add packages build script inside workspace scripts.build
- name: Build packages
run: yarn build
# Release alpha
- name: Release to @alpha tag
id: changesets
run: |
yarn changeset version --snapshot alpha
tag=$(yarn changeset publish --tag alpha | grep "New tag:" | awk '{print $4}')
echo "alpha_version=$tag" >> $GITHUB_OUTPUT
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Comment version details in PR
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.client_payload.pull_request.number }}
body: |
Publish Result: ${{ steps.changesets.outputs.alpha_version }}