Skip to content

Deploy Nightly Release #347

Deploy Nightly Release

Deploy Nightly Release #347

Workflow file for this run

on:
# fire at 00:00 on every day from Monday through Friday
schedule:
- cron: '0 0 */1 * 1-5'
workflow_dispatch:
name: Deploy Nightly Release
jobs:
nightly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Check if there are changes to deploy
id: deploy-nightly
run: |
git fetch --tags
MAIN_SHA=$(git rev-list -n 1 main)
NIGHTLY_SHA=$(git rev-list -n 1 nightly)
echo "main : $MAIN_SHA"
echo "nightly: $NIGHTLY_SHA"
echo "MAIN_SHA=$MAIN_SHA" >> $GITHUB_ENV
echo "NIGHTLY_SHA=$NIGHTLY_SHA" >> $GITHUB_ENV
if [ "$MAIN_SHA" = "$NIGHTLY_SHA" ] ; then
echo "DEPLOY=0" >> $GITHUB_OUTPUT
echo "No changes to deploy"
else
echo "DEPLOY=1" >> $GITHUB_OUTPUT
echo "Will deploy Nightly build"
fi
- name: Get version
id: version
if: steps.deploy-nightly.outputs.DEPLOY != 0
run: |
datetime=$(date +%Y%m%d%H)
pkg_version=$(node -p "require('./package.json').version")
version=$( echo $pkg_version | sed -E "s/^([0-9]+\.[0-9]+\.)[0-9]+/\1$datetime/g")
echo "DATETIME=$datetime" >> $GITHUB_ENV
echo "PKG_VERSION=$pkg_version" >> $GITHUB_ENV
echo "VERSION=$version" >> $GITHUB_ENV
- name: Publish Nightly Release
if: steps.deploy-nightly.outputs.DEPLOY != 0
run: |
echo "Publishing nightly release ${{ env.VERSION }}"
npm ci
npm i -g @vscode/vsce
vsce publish --pre-release --no-git-tag-version ${{ env.VERSION }}
env:
VSCE_PAT: ${{ secrets.VS_MARKETPLACE_TOKEN }}
- name: Create Nightly tag
if: steps.deploy-nightly.outputs.DEPLOY != 0
run: |
# git config user.name github-actions
# git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git tag --force 'nightly' ${{ github.sha }}
git tag --force 'v${{ env.VERSION }}' ${{ github.sha }}
git push --tags --force
# # Upload the artifact as a release asset
# - uses: softprops/action-gh-release@master
# with:
# files: ./*.vsix