|
| 1 | +name: Build and deploy to GitHub Pages |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ "ja" ] |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: "pages" |
| 10 | + cancel-in-progress: false |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Setup Pages |
| 20 | + id: pages |
| 21 | + uses: actions/configure-pages@v5 |
| 22 | + |
| 23 | + - name: Install dependencies |
| 24 | + run: | |
| 25 | + sudo apt update |
| 26 | + sudo apt install --yes \ |
| 27 | + lua5.3 luarocks liblua5.3-dev libyaml-dev libcmark-dev cpanminus po4a |
| 28 | +
|
| 29 | + - name: Install CommonMark Perl module |
| 30 | + run: | |
| 31 | + sudo cpanm CommonMark |
| 32 | +
|
| 33 | + - name: Install LuaRocks |
| 34 | + run: | |
| 35 | + ./translation/bin/install |
| 36 | +
|
| 37 | + - name: Install Ruby |
| 38 | + uses: ruby/setup-ruby@v1 |
| 39 | + with: |
| 40 | + ruby-version: '3.4' |
| 41 | + |
| 42 | + - name: Build pages |
| 43 | + # Run twice to correctly reflect link references |
| 44 | + run: | |
| 45 | + eval "$(luarocks path --bin)" |
| 46 | + export REFS_JA_PATH=$PWD/translation/refs.ja.yaml |
| 47 | + echo "---\n" > translation/refs.translatable.yaml |
| 48 | + git clone https://github.com/mquinson/po4a |
| 49 | + export PERL5LIB="$PWD/po4a/lib:$PERL5LIB" |
| 50 | + make --directory translation |
| 51 | + touch translation/po4a.cfg |
| 52 | + make --directory translation |
| 53 | +
|
| 54 | + - name: Upload Pages artifact |
| 55 | + uses: actions/upload-pages-artifact@v3 |
| 56 | + with: |
| 57 | + path: translation/ja/spec.html |
| 58 | + |
| 59 | + deploy: |
| 60 | + if: github.ref == 'refs/heads/ja' |
| 61 | + needs: build |
| 62 | + runs-on: ubuntu-latest |
| 63 | + steps: |
| 64 | + - name: Deploy to GitHub Pages |
| 65 | + uses: actions/deploy-pages@v4 |
| 66 | + permissions: |
| 67 | + id-token: write |
| 68 | + pages: write |
| 69 | + environment: |
| 70 | + name: github-pages |
| 71 | + url: ${{ steps.deployment.outputs.page_url }} |
0 commit comments