diff --git a/.github/actions/localization.yml b/.github/actions/localization.yml new file mode 100644 index 00000000..52c59575 --- /dev/null +++ b/.github/actions/localization.yml @@ -0,0 +1,45 @@ +name: Localization sync +description: Syncs the localization values from English to the other supported languages + +input: + TRANSLATION_API_KEY: + description: 'The API key for the translation service' + required: true + TRANSLATION_API_LOCATION: + description: 'The location of the translation service' + required: true + TRANSLATION_API_URL: + description: 'The URL of the translation service' + required: true + PACKAGE_NAME: + description: 'The name of the package to be uploaded' + required: true + +runs: + using: "composite" + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 18 + registry-url: https://registry.npmjs.org/ + cache: 'npm' + + - name: Install the dependencies + run: npm ci + + - name: Sync localization + run: npm run sync-localization + env: + TRANSLATION_API_KEY: ${{ inputs.TRANSLATION_API_KEY }} + TRANSLATION_API_LOCATION: ${{ inputs.TRANSLATION_API_LOCATION }} + TRANSLATION_API_URL: ${{ inputs.TRANSLATION_API_URL }} + + - name: Remove the node_modules + run: rm -rf node_modules + + - uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.PACKAGE_NAME }} + path: . \ No newline at end of file diff --git a/.github/workflows/release-beta.yml b/.github/workflows/release-beta.yml index 57ce9aaf..012c20ca 100644 --- a/.github/workflows/release-beta.yml +++ b/.github/workflows/release-beta.yml @@ -12,34 +12,17 @@ env: jobs: localization: - name: 'Build and release' + name: 'Localization' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: Localize the solution + uses: ./.github/actions/localization with: - node-version: 18 - registry-url: https://registry.npmjs.org/ - cache: 'npm' - - - name: Install the dependencies - run: npm ci - - - name: Run localization sync - run: npm run localization:sync - env: TRANSLATION_API_KEY: ${{ secrets.TRANSLATION_API_KEY }} TRANSLATION_API_LOCATION: ${{ secrets.TRANSLATION_API_LOCATION }} TRANSLATION_API_URL: ${{ secrets.TRANSLATION_API_URL }} - - - name: Remove the node_modules - run: rm -rf node_modules - - - uses: actions/upload-artifact@v4 - with: - name: ${{ env.PACKAGE_NAME }} - path: . + PACKAGE_NAME: ${{ env.PACKAGE_NAME }} release-ms: name: 'Release to VSCode Marketplace' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 17d55cc1..c0713098 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,19 +5,43 @@ on: - published workflow_dispatch: +env: + PACKAGE_NAME: 'fm-localized' + MS_URL: 'https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-front-matter' + VSX_URL: 'https://open-vsx.org/extension/eliostruyf/vscode-front-matter' + jobs: - build: - name: 'Build and release' + localization: + name: 'Localization' runs-on: ubuntu-latest - environment: - name: Stable steps: - - uses: actions/checkout@v4 + - name: Localize the solution + uses: ./.github/actions/localization + with: + TRANSLATION_API_KEY: ${{ secrets.TRANSLATION_API_KEY }} + TRANSLATION_API_LOCATION: ${{ secrets.TRANSLATION_API_LOCATION }} + TRANSLATION_API_URL: ${{ secrets.TRANSLATION_API_URL }} + PACKAGE_NAME: ${{ env.PACKAGE_NAME }} + + release-ms: + name: 'Release to VSCode Marketplace' + runs-on: ubuntu-latest + needs: localization + environment: + name: 'MS - Stable' + url: ${{ env.MS_URL }} + + steps: + - uses: actions/download-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + - uses: actions/setup-node@v4 with: node-version: 18 registry-url: https://registry.npmjs.org/ + cache: 'npm' - name: Install the dependencies run: npm ci @@ -25,15 +49,33 @@ jobs: - name: Prepare MAIN release run: node scripts/main-release.js - - name: Run localization sync - run: npm run localization:sync - env: - TRANSLATION_API_KEY: ${{ secrets.TRANSLATION_API_KEY }} - TRANSLATION_API_LOCATION: ${{ secrets.TRANSLATION_API_LOCATION }} - TRANSLATION_API_URL: ${{ secrets.TRANSLATION_API_URL }} - - name: Publish run: npx @vscode/vsce publish -p ${{ secrets.VSCE_PAT }} + release-vsx: + name: 'Release to Open VSX' + runs-on: ubuntu-latest + needs: localization + environment: + name: 'Open VSX - Stable' + url: ${{ env.VSX_URL }} + + steps: + - uses: actions/download-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + + - uses: actions/setup-node@v4 + with: + node-version: 18 + registry-url: https://registry.npmjs.org/ + cache: 'npm' + + - name: Install the dependencies + run: npm ci + + - name: Prepare MAIN release + run: node scripts/main-release.js + - name: Publish to open-vsx.org run: npx ovsx publish -p ${{ secrets.OPEN_VSX_PAT }}