Skip to content

Update language packs to '4.3.post0' (#748) #86

Update language packs to '4.3.post0' (#748)

Update language packs to '4.3.post0' (#748) #86

name: Create Release and publish packages
on:
push:
branches: ['main', ]
# Launch if any __init__.py files got modified on 'master' branch
paths: ['language-packs/**/__init__.py', ]
workflow_dispatch:
inputs:
skipRelease:
description: 'If "true", skip release and tag creation'
required: false
type: boolean
default: false
jobs:
# First of all check that all language packs have homogeneous version.
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Check version homogeneity
run: |
python -m pip install hatch
python scripts/04_check_version.py
build-artifacts:
name: 'Build ${{ matrix.locale }}'
needs: check-version
runs-on: ubuntu-latest
permissions:
contents: write
env:
CURRENT_LOCALE: ${{ matrix.locale }}
CURRENT_LOCALE_DIR: language-packs/jupyterlab-language-pack-${{ matrix.locale }}
strategy:
fail-fast: false
matrix:
locale:
# Should list all available locales
- ach-UG
- ar-SA
- ca-ES
- cs-CZ
- da-DK
- de-DE
- el-GR
- es-ES
- et-EE
- fi-FI
- fr-FR
- he-IL
- hu-HU
- hy-AM
- id-ID
- it-IT
- ja-JP
- ko-KR
- lt-LT
- nl-NL
- no-NO
- pl-PL
- pt-BR
- ro-RO
- ru-RU
- tr-TR
- uk-UA
- vi-VN
- zh-CN
- zh-TW
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip build hatch twine "pydantic<2.0.0"
- name: Prepare env variables
shell: bash
working-directory: "${{ env.CURRENT_LOCALE_DIR }}"
run: |
echo "CURRENT_TAG=${CURRENT_LOCALE}@v$(python -m hatch version)" >> $GITHUB_ENV
cat $GITHUB_ENV
- name: Build release artifacts
shell: bash
run: |
# Create global dist folder if it does not exist
mkdir -p dist
pushd ${{ env.CURRENT_LOCALE_DIR }}
python -m build
python -m twine check dist/*
# Copy the artifacts to the global repository
popd
cp -r ./${{ env.CURRENT_LOCALE_DIR }}/dist/* ./dist
- name: Upload language pack artifacts
uses: actions/upload-artifact@v4
with:
name: py-package-${{ matrix.locale }}
path: dist/*
- name: Create Release
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.skipRelease == 'false' }}
run: |
gh release create \
${{ env.CURRENT_TAG }} \
-t "Release ${{ env.CURRENT_TAG }}" \
${{ env.CURRENT_LOCALE_DIR }}/dist/*
env:
GITHUB_USER: ${{ secrets.GITHUB_USER }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
name: Publish all language packs at once
needs: build-artifacts
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Get the artifacts
uses: actions/download-artifact@v4
with:
path: dist
pattern: py-package-*
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true