Skip to content

Update language packs to '4.0.post0' (#473) #66

Update language packs to '4.0.post0' (#473)

Update language packs to '4.0.post0' (#473) #66

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
permissions:
contents: write
jobs:
# First of all check that all language packs have homogeneous version.
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
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
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
- 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@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip build hatch twine
- 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@v3
with:
name: pip_packages
path: dist/*
- name: Create Release
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.skipRelease == 'false' }}
run: |
hub release create \
${{ env.CURRENT_TAG }} \
-m "Release ${{ env.CURRENT_TAG }}" \
-a ${{ 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
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip twine
- name: Get the artifacts
uses: actions/download-artifact@v3
with:
name: pip_packages
path: dist
- name: Publish PyPI Packages
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python -m twine upload --skip-existing dist/*