1.16.0 #33
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy to PRD | |
on: | |
release: | |
types: [released] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
- uses: FranzDiebold/github-env-vars-action@v2 | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PACKAGE_SECRET }} | |
- name: Use Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: 'https://npm.pkg.github.com' | |
scope: '@chili-publish' | |
- name: install dependencies | |
run: | | |
yarn install | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_SECRET }} | |
- name: run license check | |
run: yarn validate-licenses | |
- name: run linting | |
run: yarn ci-lint | |
- name: run tests | |
run: yarn cover | |
- name: Bump version locally | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git fetch origin | |
git checkout -B main origin/main | |
npm version patch --no-git-tag-version | |
- name: build code | |
run: yarn build | |
- name: Commit version changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git add package.json yarn.lock | |
git commit -m "CI: Bump version to $(jq -r .version < package.json) [skip ci]" --allow-empty | |
git push origin main --follow-tags | |
- name: copy file branch | |
run: | | |
export CURRENT_PACKAGE_VERSION=$(node --eval="var pjson = require('./package.json');console.log(pjson.version);") | |
export PACKAGE_VERSION_TRIMMED=$(node --eval="const version = '$CURRENT_PACKAGE_VERSION'.split('.'); const path = version[0] + '.' + version[1]; console.log(path)") | |
export PACKAGE_VERSION_PATCH=$(node --eval="const version = '$CURRENT_PACKAGE_VERSION'.split('.');console.log(version[2])") | |
buildPath=upload/$PACKAGE_VERSION_TRIMMED/$PACKAGE_VERSION_PATCH | |
latestPath=upload/latest | |
versionedLatestPath=upload/$PACKAGE_VERSION_TRIMMED/latest | |
mkdir -p ${buildPath%"/merge"} | |
mkdir -p ${latestPath%"/merge"} | |
mkdir -p ${versionedLatestPath%"/merge"} | |
cp -R dist/* ${buildPath%"/merge"} | |
cp -R dist/* ${latestPath%"/merge"} | |
cp -R dist/* ${versionedLatestPath%"/merge"} | |
- name: Copy to Azure Blob Storage | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az storage blob upload-batch -d studio-ui -s upload/ --connection-string "${{ secrets.AZURE_CDN_STUDIO_PRD_CONNECTION_STRING }}" --overwrite true | |
bump-version: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
- uses: FranzDiebold/github-env-vars-action@v2 | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PACKAGE_SECRET }} | |
- name: Use Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: 'https://npm.pkg.github.com' | |
scope: '@chili-publish' | |
- name: Bump version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git fetch origin | |
git checkout -B main origin/main | |
npm version preminor --no-git-tag-version | |
git add package.json yarn.lock | |
git commit -m "CI: Bump version to $(jq -r .version < package.json) [skip ci]" --allow-empty | |
git push origin main --follow-tags |