Skip to content

CD-dev-11094031394-isPreview- #332

CD-dev-11094031394-isPreview-

CD-dev-11094031394-isPreview- #332

Workflow file for this run

name: "CD"
run-name: CD-${{ github.ref_name }}-${{ github.run_id }}-isPreview-${{ inputs.preview }}
on:
workflow_dispatch:
inputs:
release:
description: "run for release?"
required: true
type: boolean
default: false
preview:
description: "generate prerelease vsix?"
required: true
type: boolean
default: false
schedule:
- cron: "0 16 * * *"
jobs:
CD:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: jossef/action-set-json-field@v1
if: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.release == 'true' || github.ref == 'refs/heads/main') }}
with:
file: ./package.json
field: aiKey
value: ${{ secrets.PUBLIC_AIKEY }}
- name: update visx for preview
if: ${{ github.event.inputs.preview == 'true'}}
run: |
VERSION=$(jq -r .version ./package.json)
echo '----------------- current version:' $VERSION
MINOR_VER=$(echo $VERSION | awk -F. '{print $2}')
DATE_WITH_TIME=`date "+%Y%m%d%H"`
if [ $((MINOR_VER%2)) -eq 0 ]; then
VERSION=$(echo ${VERSION%-*} | awk -v val=$DATE_WITH_TIME -F. '/[0-9]+\./{$2++;$3=val;print}' OFS=.)
else
VERSION=$(echo ${VERSION%-*} | awk -v val=$DATE_WITH_TIME -F. '/[0-9]+\./{$3=val;print}' OFS=.)
fi
echo '----------------- prerelease version:' $VERSION
jq --arg VERSION "$VERSION" '.version=$VERSION' package.json > tmp.$$.json
mv tmp.$$.json package.json
- name: Build visx
run: |
npm install
if [ "${{ github.event.inputs.preview }}" == "true" ]; then
npx @vscode/vsce package --no-dependencies --pre-release --githubBranch ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
else
npx @vscode/vsce package --no-dependencies --githubBranch ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
fi
- uses: actions/upload-artifact@v4
with:
name: release
path: |
*.vsix
package.json