Skip to content

fix: I have changed the formatting of the generated Python syntax and… #458

fix: I have changed the formatting of the generated Python syntax and…

fix: I have changed the formatting of the generated Python syntax and… #458

name: Publish Python Package
on:
push:
branches:
- master
paths-ignore:
- "CHANGELOG.md"
- "game/__init__.py"
workflow_dispatch:
jobs:
publish-pypi-packages:
name: Publish PyPi Packages
runs-on: ubuntu-22.04
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
architecture: "x64"
- name: Install pip requirements
run: |
pip install pipenv wheel python-semantic-release==9.*
pipenv install --dev --system
pip install -U git+https://github.com/ocadotechnology/codeforlife-portal.git#egg=codeforlife-portal #TODO: Remove as part of #688
sudo apt-get install gettext
# TODO: Restore action once we figure out how to use bot token properly (if still needed)
# - name: Prepare files for Crowdin
# run: |
# mkdir -p game/locale
# cd game && django-admin makemessages -l en_GB --no-wrap && cd -
# cd game && django-admin makemessages -l en_GB --no-wrap -d djangojs --ignore "static/game/js/foundation/*" && cd - # some files from foundation use '_' for their own purpose
# - name: Run Crowdin (Upload sources and download translations)
# uses: crowdin/github-action@v1
# with:
# upload_sources: true
# download_translations: true
# push_translations: false
# project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
# token: ${{ secrets.CROWDIN_API_KEY }}
# env:
# GITHUB_TOKEN: ${{ secrets.CFL_BOT_GITHUB_TOKEN }}
# - name: Fix translation files owner
# run: sudo chown -R $USER game/locale
# - name: Compile messages
# run: |
# pushd game
# django-admin compilemessages
# popd
- name: 📜 Detect Semantic Version
env:
GH_TOKEN: ${{ secrets.CFL_BOT_GITHUB_TOKEN }}
run: semantic-release version
- name: Build package
run: python setup.py sdist bdist_wheel
- name: 🚀 Publish Semantic Release
env:
GH_TOKEN: ${{ secrets.CFL_BOT_GITHUB_TOKEN }}
run: semantic-release publish
- name: 🚀 Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
- name: Trigger staging deployment
uses: actions/github-script@v6
with:
github-token: ${{ secrets.CFL_BOT_GITHUB_TOKEN }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: 'ocadotechnology',
repo: 'codeforlife-deploy-appengine',
workflow_id: 'deploy_staging.yml',
ref: 'master',
});