Skip to content

Merge pull request #443 from kelvininc/gc/icons #791

Merge pull request #443 from kelvininc/gc/icons

Merge pull request #443 from kelvininc/gc/icons #791

Workflow file for this run

name: publish-alpha
on:
push:
branches:
- alpha
- beta
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write # for checkout and tag
jobs:
publish:
strategy:
matrix:
os: [ubuntu-22.04]
node: [18.x]
name: Pre-Release Publish (${{ matrix.os }} / Node.js ${{ matrix.node }})
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Git Identity
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js ${{ matrix.node }}
uses: ./.github/actions/node-setup
with:
node-version: ${{ matrix.node }}
- name: Get Tag
run: echo "LAST_VERSION=$(git describe --tags `git rev-list --tags --max-count=1` | tr -d v)" >> $GITHUB_ENV
- name: Get Current Version
run: |
CURRENT_VERSION=$(node -p 'require("./lerna.json").version')
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
- name: Set Version
if: env.CURRENT_VERSION != env.LAST_VERSION
run: |
sed -ie "s/\(\"version\": \"\).[^\"]*/\1$LAST_VERSION/" lerna.json
git add lerna.json
git commit -m 'chore(release): publish alpha version [skip ci]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Versions (Amend)
if: env.CURRENT_VERSION != env.LAST_VERSION
run: |
npx lerna version prerelease --yes --conventional-commits --conventional-prerelease --no-changelog --amend --force-publish=*
git push origin alpha --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Versions
if: env.CURRENT_VERSION == env.LAST_VERSION
run: |
npx lerna version prerelease --yes --conventional-commits --conventional-prerelease --no-changelog --force-publish=*
git push origin alpha --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build packages
run: npm run build:packages
- name: Setting NPM
run: |
npm set registry=https://nexus.kelvininc.com/repository/npm-internal
npm set "//nexus.kelvininc.com/:_auth=$USER_AUTH"
env:
USER_AUTH: ${{ secrets.NEXUS_AUTH }}
- name: Publish to Nexus
run: |
git reset --hard
npx lerna publish from-git --yes --canary --force-publish=*
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
USER_AUTH: ${{ secrets.NEXUS_AUTH }}
- name: Push Tag
run: git push origin $(git describe --tags --abbrev=0)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}