ci: testing #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Jekyll site to Pages | |
on: | |
push: | |
branches: ["main", "gh-pages"] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages-${{ github.ref }}" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
lang: ['en', 'de', 'es'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 | |
with: | |
ruby-version: '3.1' | |
bundler-cache: true | |
- name: Set language in config | |
run: | | |
sed -i "/^lang:/c\lang: ${{ matrix.lang }}" _config.yml | |
if ! grep -q "^lang:" _config.yml; then | |
echo "lang: ${{ matrix.lang }}" >> _config.yml | |
fi | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v5 | |
- name: Build with Jekyll | |
run: bundle exec jekyll build --destination _site/${{ matrix.lang }} --baseurl "${{ steps.pages.outputs.base_path }}/${{ matrix.lang }}" | |
env: | |
JEKYLL_ENV: production | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./_site/${{ matrix.lang }} | |
name: site-${{ matrix.lang }} | |
create-index: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create index.html | |
run: | | |
echo '<!DOCTYPE html>' > index.html | |
echo '<html lang="en">' >> index.html | |
echo '<head>' >> index.html | |
echo ' <meta charset="UTF-8">' >> index.html | |
echo ' <meta name="viewport" content="width=device-width, initial-scale=1.0">' >> index.html | |
echo ' <title>Welcome to Our Multilingual Site</title>' >> index.html | |
echo '</head>' >> index.html | |
echo '<body>' >> index.html | |
echo ' <h1>Welcome to Our Multilingual Site</h1>' >> index.html | |
echo ' <ul>' >> index.html | |
echo ' <li><a href="/de/">Deutsch</a></li>' >> index.html | |
echo ' <li><a href="/en/">English</a></li>' >> index.html | |
echo ' <li><a href="/es/">Español</a></li>' >> index.html | |
echo ' </ul>' >> index.html | |
echo '</body>' >> index.html | |
echo '</html>' >> index.html | |
mkdir _site | |
mv index.html _site/ | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./_site/ | |
name: site | |
deploy: | |
needs: create-index | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: _site | |
merge-multiple: true | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 |