Skip to content

Merge pull request #863 from WTW-IM/fix-types-export #195

Merge pull request #863 from WTW-IM/fix-types-export

Merge pull request #863 from WTW-IM/fix-types-export #195

Workflow file for this run

name: Preproduction Release
on:
push:
branches:
- pre-prod
jobs:
pre-prod-release:
if: ${{ github.ref == 'refs/heads/pre-prod' && !contains(github.event.head_commit.message, '[skip-release]') }}
name: Publish Pre-Prod NPM Packages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PIPELINE_BOT_PAT }}
ref: pre-prod
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'npm'
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-
- name: Install Dependencies
run: |
npm i --prefer-offline --no-audit
- name: Set Commitbot Identity
run: |
git config user.name "ES-Components Lerna Publish Bot"
git config user.email "[email protected]"
- name: Lerna Publish
run: |
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" > ~/.npmrc
npx lerna publish \
--conventional-commits \
--changelog-preset @aabenoja/conventional-changelog-eslint-lerna \
--conventional-prerelease \
--dist-tag pre-prod \
--preid pre-prod \
--allow-branch pre-prod \
--yes
docs:
if: ${{ github.ref == 'refs/heads/pre-prod' }}
needs: pre-prod-release
name: Publish Docs to GH Pages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PIPELINE_BOT_PAT }}
ref: pre-prod
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'npm'
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-
- name: Install Dependencies
run: |
npm i --prefer-offline --no-audit
- name: Set Commitbot Identity
run: |
git config user.name "ES-Components Lerna Publish Bot"
git config user.email "[email protected]"
- name: Rebuild Pre-Prod Docs
working-directory: packages/es-components
run: |
npm run pre-prod-sg-build
- name: Configure docs changes
run: |
git stash
git checkout gh-pages
git stash show -p | git apply && git stash drop
rm -rf build/
mkdir -p pre-prod
cp -r ./packages/es-components/docs/pre-prod/* ./pre-prod
git add pre-prod
DIFF_RESULT=$(git diff --staged --quiet --exit-code; echo "$?")
HAS_CHANGES=$(
if [ $DIFF_RESULT -eq 0 ]
then echo "false"
else echo "true"
fi
)
echo "Has docs changes? $HAS_CHANGES"
echo "HAS_CHANGES=$HAS_CHANGES" >> $GITHUB_ENV
- name: Publish docs to github pages
if: env.HAS_CHANGES == 'true'
run: |
git commit -m "Deploy es-component pre-prod docs to gh-pages"
git push origin gh-pages