CD #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CD | |
on: | |
workflow_run: | |
workflows: ["CI"] | |
types: | |
- completed | |
branches: | |
- main | |
permissions: {} | |
jobs: | |
publish-latest-update-site: | |
name: Publish Latest Extension # (from main branch only) | |
runs-on: ubuntu-latest | |
# we are very restrictive when this runs, i.e. only on main, only on success and only with the bazel-vscode-java repository (not on forks) | |
if: > | |
github.event.workflow_run.conclusion == 'success' && | |
github.event.workflow_run.event != 'pull_request' && | |
github.repository == 'salesforce/bazel-vscode-java' && | |
github.ref == 'refs/heads/main' | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get Time for BUILD_ID | |
id: time | |
uses: nanzm/get-time-action@v2.0 | |
with: | |
format: "YYYYMMDD_HHmm" | |
- name: Get Branch name for BUILD_LABEL | |
id: branch_name | |
shell: bash | |
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
- name: Setup Node version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'npm' | |
- name: π¦ Install dependencies | |
run: npm ci | |
- name: Download Bazel JDT Language Server extension | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
run_id: ${{ github.event.workflow_run.id }} | |
name: server | |
path: server | |
- name: π Build project | |
env: | |
BUILD_ID: "${{ steps.time.outputs.time }}" | |
BUILD_TYPE: "S" | |
BUILD_LABEL: "CI ${{ steps.time.outputs.time }} (${{ steps.branch_name.outputs.branch }})" | |
run: npm run build:prod | |
- name: π¦ Prepare packaging of pre-release extension | |
run: | | |
npm install -g vsce | |
npx gulp prepare_pre_release | |
- name: π Publish pre-release to Visual Studio Marketplace | |
uses: HaaLeo/publish-vscode-extension@v1 | |
id: publishToVscMktp | |
with: | |
preRelease: true | |
pat: ${{ secrets.VSC_MKTP_TOKEN }} | |
registryUrl: https://marketplace.visualstudio.com | |
- name: π Publish pre-release to Open VSX Registry | |
uses: HaaLeo/publish-vscode-extension@v1 | |
with: | |
preRelease: true | |
pat: ${{ secrets.OPEN_VSX_TOKEN }} | |
extensionFile: ${{ steps.publishToVscMktp.outputs.vsixPath }} |