Skip to content

Release

Release #110

Workflow file for this run

name: Release
on:
release:
types:
- published
workflow_dispatch:
inputs:
publishMS:
description: 'Publish to MS marketplace'
type: boolean
required: true
default: false
publishGH:
description: 'Publish to GitHub releases'
type: boolean
required: true
default: true
jobs:
packageVSIX:
name: Package the extension
runs-on: ubuntu-latest
outputs:
packageName: ${{ steps.setup.outputs.packageName }}
tag: ${{ steps.setup-tag.outputs.tag }}
version: ${{ steps.setup-tag.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
- name: Create l10n directory
run: |
mkdir ./l10n
- name: Extract localisable strings from app
run: |
npx @vscode/l10n-dev export --outDir ./l10n ./src
- name: Show localisable strings file
run: |
cat l10n/bundle.l10n.json
- name: Translate app strings
run: |
npx @vscode/l10n-dev generate-azure -o ./l10n/ ./l10n/bundle.l10n.json ./package.nls.json -l zh-Hans ja es ru pt fr ko zh-Hant it pl hu cs bg tr my ca lt hy
env:
AZURE_TRANSLATOR_KEY: ${{ secrets.AZURE_TRANSLATOR_KEY_FREE }}
AZURE_TRANSLATOR_REGION: global
# - name: Translate manual
# run: node --trace-uncaught --experimental-modules translate.mjs doc/manual.md
# env:
# AZURE_TRANSLATOR_KEY: ${{ secrets.AZURE_TRANSLATOR_KEY }}
# AZURE_TRANSLATOR_REGION: westus2
# - name: Translate readme
# run: node --trace-uncaught --experimental-modules translate.mjs README.md
# env:
# AZURE_TRANSLATOR_KEY: ${{ secrets.AZURE_TRANSLATOR_KEY }}
# AZURE_TRANSLATOR_REGION: westus2
- name: Setup package path
id: setup
run: echo "::set-output name=packageName::$(node -e "console.log(require('./package.json').name + '-' + require('./package.json').version + '.vsix')")"
- name: Bundle using Webpack
env:
VSIX_PACKAGE_PATH: ${{ steps.setup.outputs.packageName }}
run: npx @vscode/vsce package
- uses: actions/upload-artifact@v3
with:
name: ${{ steps.setup.outputs.packageName }}
path: ${{ steps.setup.outputs.packageName }}
- name: Setup tag
id: setup-tag
run: |
$version = (Get-Content ./package.json -Raw | ConvertFrom-Json).version
Write-Host "tag: release/$version"
Write-Host "::set-output name=tag::release/$version"
Write-Host "::set-output name=version::$version"
shell: pwsh
- if: failure()
name: Delete tag
uses: prompt/actions-delete-tag@v1
publishMS:
name: Publish to MS marketplace
runs-on: ubuntu-latest
needs: packageVSIX
if: github.event.inputs.publishMS == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: ${{ needs.packageVSIX.outputs.packageName }}
- name: Publish to MS marketplace
run: vsce publish --packagePath ./${{ needs.packageVSIX.outputs.packageName }} -p ${{ secrets.AZUREDEVOPS_PRINT_RELEASE }}
publishGH:
name: Publish to GitHub releases
runs-on: ubuntu-latest
needs: packageVSIX
if: github.event.inputs.publishGH == 'true'
steps:
- uses: actions/download-artifact@v3
with:
name: ${{ needs.packageVSIX.outputs.packageName }}
- name: Commit tagger
uses: tvdias/[email protected]
with:
repo-token: ${{ secrets.PRINT_RELEASE }}
tag: ${{ needs.packageVSIX.outputs.tag }}
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
PRINT_RELEASE: ${{ secrets.PRINT_RELEASE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.packageVSIX.outputs.tag }}
release_name: Release ${{ needs.packageVSIX.outputs.version }}
draft: false
prerelease: false
- name: Upload assets to a Release
uses: AButler/[email protected]
with:
files: ${{ needs.packageVSIX.outputs.packageName }}
release-tag: ${{ needs.packageVSIX.outputs.tag }}
repo-token: ${{ secrets.PRINT_RELEASE }}