-
-
Notifications
You must be signed in to change notification settings - Fork 30
69 lines (62 loc) · 2.3 KB
/
nightly.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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