Skip to content

Publish Release

Publish Release #90

name: Publish Release
on:
release:
types: [released]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PACKAGE_SECRET }}
- name: Check cache
id: cache
uses: actions/cache@v1
with:
path: packages/sdk/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}-0
restore-keys: |
${{ runner.os }}-node-
- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: "https://registry.npmjs.org"
- name: install dependencies
run: yarn install
- name: run linting
run: yarn ci-lint
- name: run tests
run: yarn cover
- name: bump version locally
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 patch
- name: run readmeUpdater
run: yarn make-badges
- name: execute local js script
run: node ./.github/scripts/replicate-version.js
- name: build code
run: yarn build
- name: publish sdk build
run: |
# Get the full reference of the release
ref=${{ github.ref }}
# Remove the refs/tags/ prefix
tag=${ref#refs/tags/}
stripped_tag=${tag%-*}
node cicd.js sdk,connectors yarn publish --tag $stripped_tag --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Use Node ${{ matrix.node-version }} for dev release
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: "https://npm.pkg.github.com"
scope: "@chili-publish"
- name: publish sdk build
run: node cicd.js sdk,connectors yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_SECRET }}
- name: execute commit script
run: node ./.github/scripts/commit.js
- name: get new npm version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: copy file branch
run: |
path=packages/sdk/upload/latest
versionpath=packages/sdk/upload/${{ github.event.release.name }}
mkdir -p ${path%"/merge"}
cp -R packages/sdk/_bundles/* ${path%"/merge"}
mkdir -p ${versionpath%"/merge"}
cp -R packages/sdk/_bundles/* ${versionpath%"/merge"}
- name: Copy to Azure Blob Storage
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob upload-batch -d sdk -s packages/sdk/upload/ --connection-string "${{ secrets.AZURE_CDN_STUDIO_PRD_CONNECTION_STRING }}" --overwrite true
- name: prepare for actions upload
run: |
node cicd.js actions node scripts/prepare-release.mjs
- name: Copy to Azure Blob Storage (Actions)
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob upload-batch -d sdk -s packages/actions/cdn/ --connection-string "${{ secrets.AZURE_CDN_STUDIO_PRD_CONNECTION_STRING }}" --overwrite true
bump:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
needs: build
steps:
- uses: FranzDiebold/github-env-vars-action@v2
- uses: actions/checkout@v3
with:
token: ${{ secrets.PACKAGE_SECRET }}
- 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
- name: execute local js script
run: node ./.github/scripts/replicate-version.js
- name: execute commit script
run: node ./.github/scripts/commit.js