OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.38k stars 1.12k forks source link

Move Crowdin translation package build to a GH workflow in this repo #8642

Closed BenedekFarkas closed 1 year ago

BenedekFarkas commented 1 year ago

Currently it's running periodically (every half hour) in our TeamCity environment. We are in the process of moving away from TeamCity in favor of GitHub Actions, so we'd move the Crowdin build here to a workflow to run daily (which would be a sufficient frequency for the current activity too).

sebastienros commented 1 year ago

Sure, and AFAIR there were discussions to also have the builds happen on GH actions too.

to a workflow to run daily

Why not just when necessary like we do for orchard code? Or is it to create dev packages for testing, on myget/cloudsmith.

BenedekFarkas commented 1 year ago

Hmm, I think you're talking about building the translation source files (of en-US culture from the code) for a release, right? Actually, that would be nice to put in a workflow, but the module that can do that is only compatible with Orchard 1.6, so I keep a repo set up with it just for this purpose.

This issue would be about building the translation packages for other languages, which doesn't happen automatically, so if new strings are translated, you can't download them right away, because the packages need to be rebuilt first (unless that behavior changed in some way in Crowdin since I last checked, which was a long time ago though).

BenedekFarkas commented 1 year ago

So we discussed in the community meeting yesterday that we're good to go with moving this logic into this repo in a workflow. BTW I asked ChatGPT to generate the skeleton for that workflow with the following prompt:

Create a GitHub Actions workflow that can be triggered manually and also runs on a daily schedule at noon. The workflow should have two steps running a PowerShell script, but leave steps empty for now.

And got this (alongside a detailed and accurate explanation):

name: Daily PowerShell Script

on:
  workflow_dispatch:
  schedule:
    - cron: '0 12 * * *'

jobs:
  run-script:
    runs-on: windows-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Run PowerShell Script 1
      shell: powershell
      run: |
        # Add your PowerShell script 1 here

    - name: Run PowerShell Script 2
      shell: powershell
      run: |
        # Add your PowerShell script 2 here

Then:

Can you please update the workflow to use pwsh as the default shell, so that the steps don't need define the shell property? You can also remove the checkout step.

(yes I'm polite with it, so it might leave me alive if it takes over humanity :D)

name: Daily PowerShell Script

on:
  workflow_dispatch:
  schedule:
    - cron: '0 12 * * *'

jobs:
  run-script:
    runs-on: windows-latest

    steps:
    - name: Run PowerShell Script 1
      run: |
        # Add your PowerShell script 1 here

    - name: Run PowerShell Script 2
      run: |
        # Add your PowerShell script 2 here

It says Since pwsh is used as the default shell, you don't need to specify the shell property in each step., which I didn't know. :) One small change is that it should run under Ubuntu (that I asked it to modify later), other than that this looks perfect!

BenedekFarkas commented 1 year ago

8660 ready for review!

Piedone commented 1 year ago

Nice ChatGPT usage :).