|
| 1 | +on: |
| 2 | + # fire at 00:00 on every day from Monday through Friday |
| 3 | + schedule: |
| 4 | + - cron: '0 0 */1 * 1-5' |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +name: Deploy Nightly Release |
| 8 | +jobs: |
| 9 | + nightly: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v3 |
| 13 | + - uses: actions/setup-node@v3 |
| 14 | + with: |
| 15 | + node-version: 18 |
| 16 | + |
| 17 | + - name: Check if there are changes to deploy |
| 18 | + id: deploy-nightly |
| 19 | + run: | |
| 20 | + echo "::set-output name=MAIN-SHA::$(git rev-list -n 1 main)" |
| 21 | + echo "::set-output name=NIGHTLY-SHA::$(git rev-list -n 1 nightly)" |
| 22 | +
|
| 23 | + - name: Get version |
| 24 | + id: version |
| 25 | + if: ${{ steps.deploy-nightly.outputs.MAIN-SHA != steps.deploy-nightly.outputs.NIGHTLY-SHA }} |
| 26 | + run: | |
| 27 | + datetime=$(date +%Y%m%d%H%M) |
| 28 | + pkg_version=$(node -p "require('./package.json').version") |
| 29 | + version=$( echo $pkg_version | sed -E "s/^([0-9]+\.[0-9]+\.)[0-9]+/\1$datetime/g") |
| 30 | + echo "::set-output name=DATETIME::$datetime" |
| 31 | + echo "::set-output name=PKG_VERSION::$pkg_version" |
| 32 | + echo "::set-output name=VERSION::$version" |
| 33 | +
|
| 34 | + - name: Publish Nightly Release |
| 35 | + if: ${{ steps.deploy-nightly.outputs.MAIN-SHA != steps.deploy-nightly.outputs.NIGHTLY-SHA }} |
| 36 | + run: | |
| 37 | + echo "Publishing nightly release ${{ steps.version.outputs.VERSION }}" |
| 38 | + npm ci |
| 39 | + npm i -g vsce |
| 40 | + vsce publish --pre-release --no-git-tag-version --no-update-package-json ${{ steps.version.outputs.VERSION }} |
| 41 | + env: |
| 42 | + VSCE_PAT: ${{ secrets.VS_MARKETPLACE_TOKEN }} |
| 43 | + |
| 44 | + - name: Create Nightly tag |
| 45 | + if: ${{ steps.deploy-nightly.outputs.MAIN-SHA != steps.deploy-nightly.outputs.NIGHTLY-SHA }} |
| 46 | + run: | |
| 47 | + # git config user.name github-actions |
| 48 | + # git config user.email 41898282+github-actions[bot]@users.noreply.github.com |
| 49 | + git tag --force 'nightly' ${{ github.sha }} |
| 50 | + git tag --force 'v${{ steps.version.outputs.VERSION }}' ${{ github.sha }} |
| 51 | + git push --tags --force |
| 52 | +
|
| 53 | + # # Upload the artifact as a release asset |
| 54 | + # - uses: softprops/action-gh-release@master |
| 55 | + # with: |
| 56 | + # files: ./*.vsix |
0 commit comments