ci: fix invenio-software.org deployment #16
This file contains hidden or 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 to GitHub Pages | |
| on: | |
| push: | |
| branches: [master] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| - name: Persist npm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} | |
| - name: Persist Eleventy .cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ./.cache | |
| key: ${{ runner.os }}-eleventy-fetch-cache | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build site | |
| run: npm run build-ghpages | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site | |
| # deploy to inveniosoftware.org | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| # custom: deploy to invenio-software.org | |
| deploy-to-dashed: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download built site | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: site | |
| path: _site | |
| - name: Checkout invenio-software.org | |
| run: | | |
| git clone --depth=1 --branch gh-pages \ | |
| https://x-access-token:${{ secrets.LEKTOR_DEPLOY_TOKEN_INVENIOBOT }}@github.com/inveniosoftware/invenio-software.org dashed | |
| - name: Sync built site | |
| run: | | |
| rm -rf dashed/* | |
| cp -r _site/* dashed/ | |
| - name: Commit and push to target repo | |
| working-directory: dashed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "Deploy from inveniosoftware site" | |
| git push origin gh-pages |