Skip to content

Commit

Permalink
chore: improve publication process
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed Aug 12, 2022
1 parent cd0e84f commit be2964f
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 8 deletions.
33 changes: 25 additions & 8 deletions .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,34 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
publish:
list_extensions:
runs-on: ubuntu-latest
outputs:
extension_list: ${{ env.EXTENSION_LIST }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref }}
- name: Install
run: npm install
- name: Publish VSCE
run: npx lerna exec --no-bail "vsce publish -p ${{ secrets.VSCE_TOKEN }}" || echo done
- name: Publish OVSX
run: npx lerna exec --no-bail "ovsx publish -p ${{ secrets.OVSX_TOKEN }}" || echo done
ref: ${{ inputs.ref }}

- name: From Script
run: |
echo extensions_from_script=$(./scripts/list-extensions.sh) >> $GITHUB_ENV
- name: EXTENSION_LIST
env:
EXTENSION_LIST: ${{ inputs.paths_released || env.extensions_from_script }}
run: |
echo EXTENSION_LIST=$EXTENSION_LIST >> $GITHUB_ENV
publish:
needs:
- list_extensions
uses: ./.github/workflows/publish.yml
with:
ref: ${{ inputs.ref }}
paths_released: ${{ needs.list_extensions.outputs.extension_list }}
secrets:
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
OVSX_TOKEN: ${{ secrets.OVSX_TOKEN }}
# cspell:ignore vsix xargs OVSX
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This is a basic workflow that is manually triggered

name: "[sub] Publish to Marketplace"

on:
workflow_call:
inputs:
ref:
type: string
required: true
paths_released:
type: string
required: true
secrets:
OVSX_TOKEN:
required: true
VSCE_TOKEN:
required: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
publish:
runs-on: ubuntu-latest
strategy:
matrix:
extension_dir: ${{ fromJSON(inputs.paths_released) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Install
run: npm install
- name: Prepare Try to Release
run: echo "${{ matrix.extension_dir }}"
# - name: Publish VSCE
# run: npx lerna exec --no-bail "vsce publish -p ${{ secrets.VSCE_TOKEN }}" || echo done
# - name: Publish OVSX
# run: npx lerna exec --no-bail "ovsx publish -p ${{ secrets.OVSX_TOKEN }}" || echo done
# cspell:ignore vsix xargs OVSX
10 changes: 10 additions & 0 deletions scripts/list-extensions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
JQ_FILTER_PACKAGES="$SCRIPT_DIR/code-workspace-packages.jq"

FOLDERS="$(echo $(ls -1 extensions/*/package.json) \
| xargs jq -f $JQ_FILTER_PACKAGES \
| jq ".path" | jq -s ".")"

echo $FOLDERS

0 comments on commit be2964f

Please sign in to comment.