Skip to content

Commit

Permalink
chore: Improve Publication (#351)
Browse files Browse the repository at this point in the history
* Improve Publication
* Speed Up Tests
  • Loading branch information
Jason3S committed Aug 12, 2022
1 parent 60373f0 commit feb38dc
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 21 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint

on: # rebuild any PRs and main branch changes
workflow_dispatch:
pull_request:
push:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: npm
- run: npm install
- run: npm run lint
51 changes: 50 additions & 1 deletion .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,43 @@ on:
Otherwise, uses the default branch.
required: true
default: main
extension:
description: The Extension to publish
type: choice
# Options are can be generated from `./scripts/extensions.sh`
options:
[
"extensions/arabic",
"extensions/bulgarian",
"extensions/catalan",
"extensions/croatian",
"extensions/czech",
"extensions/danish",
"extensions/dutch",
"extensions/esperanto",
"extensions/estonian",
"extensions/french-reforme",
"extensions/french",
"extensions/german",
"extensions/greek",
"extensions/hebrew",
"extensions/italian",
"extensions/medical-terms",
"extensions/norwegian-bokmal",
"extensions/persian",
"extensions/polish",
"extensions/portuguese-brazilian",
"extensions/portuguese",
"extensions/russian",
"extensions/scientific-terms",
"extensions/slovenian",
"extensions/spanish",
"extensions/swedish",
"extensions/turkish",
"extensions/ukrainian",
"extensions/vietnamese",
]
required: false

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand All @@ -26,13 +63,25 @@ jobs:
with:
ref: ${{ inputs.ref }}

- name: Inputs
env:
INPUTS: ${{ toJSON(inputs) }}
run: |
echo "$INPUTS"
- name: Choice
env:
INPUT_CHOICE: ${{ (inputs.extension && format('["{0}"]', inputs.extension)) }}
run: |
echo INPUT_CHOICE=$INPUT_CHOICE >> $GITHUB_ENV
- name: From Script
run: |
echo extensions_from_script=$(./scripts/list-extensions.sh) >> $GITHUB_ENV
- name: EXTENSION_LIST
env:
EXTENSION_LIST: ${{ env.extensions_from_script }}
EXTENSION_LIST: ${{ env.INPUT_CHOICE || env.extensions_from_script }}
run: |
echo EXTENSION_LIST=$EXTENSION_LIST >> $GITHUB_ENV
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,25 @@ jobs:
echo EXTENSION_DIR=${{ matrix.extension_dir }} >> $GITHUB_ENV
cd $EXTENSION_DIR
echo EXTENSION_NAME=$(jq -r .name package.json ) >> $GITHUB_ENV
- name: Publish VSCE
run: |
cd $EXTENSION_DIR
vsce publish -p ${{ secrets.VSCE_TOKEN }} || echo "PUB_FAIL_VSCE=true" >> $GITHUB_ENV
- name: Publish OVSX
run: |
cd $EXTENSION_DIR
ovsx publish -p ${{ secrets.OVSX_TOKEN }} || echo "PUB_FAIL_OVSX=true" >> $GITHUB_ENV
npx vsce publish -p ${{ secrets.VSCE_TOKEN }} || echo "PUB_FAIL_VSCE=true" >> $GITHUB_ENV
- name: Check Publish Result VSCE
if: ${{ env.PUB_FAIL_VSCE }}
run: echo "::error title=VSCE::Failed to Publish $EXTENSION_NAME to VS Code Marketplace."

- name: Publish OVSX
run: >
find ./build -name "*.vsix" | xargs npx ovsx publish -p ${{ secrets.OVSX_TOKEN }}
|| echo "PUB_FAIL_OVSX=true" >> $GITHUB_ENV
run: |
cd $EXTENSION_DIR
npx ovsx publish -p ${{ secrets.OVSX_TOKEN }} || echo "PUB_FAIL_OVSX=true" >> $GITHUB_ENV
- name: Check Publish Result OVSX
if: ${{ env.PUB_FAIL_OVSX }}
run: echo "::error title=OVSX::Failed to Publish $EXTENSION_NAME to Eclipse Open VSX."

- name: Check Build
if: ${{ env.PUB_FAIL_VSCE || env.PUB_FAIL_OVSX }}
run: exit 1
Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
outputs:
release_created: ${{ steps.release.outputs.release_created }}
release_please_info: ${{ toJSON(steps.release.outputs) }}
paths_released: ${{ steps.release.outputs.paths_released }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
Expand All @@ -30,13 +31,18 @@ jobs:
release_please_info: ${{ needs.release-please.outputs.release_please_info }}
steps:
- name: Show Release Please Results
run: echo "$release_please_info"
run: |
echo "$release_please_info"
echo "${{ needs.release-please.outputs.paths_released }}"
# publish:
# needs:
# - release-please
# uses: ./.github/workflows/publish.yml
# secrets:
# PUBLISH_NPM: ${{ secrets.PUBLISH_NPM }}
# if: ${{ needs.release-please.outputs.release_created }}
# cspell:ignore noreply
publish:
needs:
- release-please
uses: ./.github/workflows/publish.yml
with:
ref: main
paths_released: ${{ needs.release-please.outputs.paths_released }}
secrets:
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
OVSX_TOKEN: ${{ secrets.OVSX_TOKEN }}
if: ${{ needs.release-please.outputs.release_created }}
29 changes: 27 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,44 @@
name: "build-test"
on: # rebuild any PRs and main branch changes
workflow_dispatch:
pull_request:
push:
branches:
- main

jobs:
list_extensions:
runs-on: ubuntu-latest
outputs:
extension_list: ${{ env.EXTENSION_LIST }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: From Script
run: |
echo extensions_from_script=$(./scripts/list-extensions.sh) >> $GITHUB_ENV
- name: EXTENSION_LIST
env:
EXTENSION_LIST: ${{ env.extensions_from_script }}
run: |
echo EXTENSION_LIST=$EXTENSION_LIST >> $GITHUB_ENV
build-test:
runs-on: ubuntu-latest
needs:
- list_extensions
strategy:
matrix:
extension_dir: ${{ fromJSON(needs.list_extensions.outputs.extension_list) }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
cache: npm
- run: npm install
- run: npm run test-pack
- run: npm run lint
- run: |
cd ${{ matrix.extension_dir }}
npm run pack-extension
5 changes: 5 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@
"addWords": true
}
],
"useGitignore": true,
"ignorePaths": [
".git",
"*.vsix",
"extensions/*/samples/**",
"node_modules",
".vscodeignore",
".travis.yml",
".vscode",
".gitignore",
"package-lock.json"
],
"dictionaries": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"echo": "echo $OVSX_TOKEN",
"build": "lerna run build",
"test-pack": "lerna run pack-extension",
"cspell": "npx cspell \"**/*\" \".*/**/*\"",
"cspell": "npx cspell \"**\" --dot --no-progress",
"X-lint": "eslint . --fix --cache && prettier -w \"**/*.{md,yaml,yml,json}\"",
"X-lint-ci": "eslint . && prettier -c \"**/*.{md,yaml,yml,json}\"",
"prettier:fix": "prettier -w \"**/*.{ts,md,yaml,yml,json}\"",
Expand Down

0 comments on commit feb38dc

Please sign in to comment.