|
| 1 | +name: Build GH Page |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - 'main' |
| 8 | + paths: |
| 9 | + - 'otterdog/*.jsonnet' |
| 10 | + - 'docs/**' |
| 11 | + - 'mkdocs.yml' |
| 12 | + - '.github/workflows/build-page.yml' |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: "pages" |
| 16 | + cancel-in-progress: false |
| 17 | + |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + pages: write |
| 21 | + id-token: write |
| 22 | + |
| 23 | +jobs: |
| 24 | + generate-markdown: |
| 25 | + # do not run the workflow in the template repo itself |
| 26 | + if: ${{ !contains (github.repository, '/.eclipsefdn-template') }} |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - name: Checkout eclipse-csi/otterdog |
| 30 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 31 | + with: |
| 32 | + repository: eclipse-csi/otterdog |
| 33 | + path: otterdog |
| 34 | + |
| 35 | + - name: Checkout EclipseFdn/otterdog-configs |
| 36 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 37 | + with: |
| 38 | + repository: EclipseFdn/otterdog-configs |
| 39 | + path: otterdog-configs |
| 40 | + |
| 41 | + # checkout the HEAD ref |
| 42 | + - name: Checkout HEAD |
| 43 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 44 | + with: |
| 45 | + path: ${{ github.repository_owner }} |
| 46 | + |
| 47 | + - name: Install jsonnet-bundler |
| 48 | + run: | |
| 49 | + go install -a github.com/jsonnet-bundler/jsonnet-bundler/cmd/[email protected] |
| 50 | + echo $(go env GOPATH)/bin >> $GITHUB_PATH |
| 51 | +
|
| 52 | + - name: Install poetry |
| 53 | + run: pipx install poetry |
| 54 | + |
| 55 | + - name: Setup Python |
| 56 | + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 |
| 57 | + with: |
| 58 | + python-version: '3.10' |
| 59 | + cache: 'poetry' |
| 60 | + |
| 61 | + - name: Install dependencies with poetry |
| 62 | + run: | |
| 63 | + poetry install --only=main |
| 64 | + working-directory: otterdog |
| 65 | + |
| 66 | + - name: Copy configuration from HEAD ref |
| 67 | + run: | |
| 68 | + mkdir -p orgs/${{ github.repository_owner }} |
| 69 | + cp -r ../${{ github.repository_owner }}/otterdog/* orgs/${{ github.repository_owner }} |
| 70 | + working-directory: otterdog-configs |
| 71 | + |
| 72 | + - name: Generate default configuration as markdown |
| 73 | + run: ../otterdog/otterdog.sh show-default ${{ github.repository_owner }} -c otterdog.json --markdown > default.txt |
| 74 | + working-directory: otterdog-configs |
| 75 | + |
| 76 | + - name: Upload generated site content |
| 77 | + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 |
| 78 | + with: |
| 79 | + name: generated-site |
| 80 | + path: | |
| 81 | + otterdog-configs/default.txt |
| 82 | + otterdog-configs/orgs/${{ github.repository_owner }}/vendor/otterdog-defaults/*.libsonnet |
| 83 | +
|
| 84 | + build-page: |
| 85 | + runs-on: ubuntu-latest |
| 86 | + needs: generate-markdown |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 89 | + - name: Download generated site content |
| 90 | + uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 |
| 91 | + with: |
| 92 | + name: generated-site |
| 93 | + - shell: bash |
| 94 | + run: | |
| 95 | + cat default.txt >> ./docs/playground.md |
| 96 | + cp orgs/${{ github.repository_owner }}/vendor/otterdog-defaults/*.libsonnet ./docs/jsonnet/ |
| 97 | + - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 |
| 98 | + with: |
| 99 | + python-version: 3.x |
| 100 | + cache: 'pip' |
| 101 | + - run: pip install -r requirements.txt |
| 102 | + - name: Build with Mkdocs |
| 103 | + run: mkdocs build |
| 104 | + - name: Setup Pages |
| 105 | + uses: actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d # v4.0.0 |
| 106 | + - name: Upload artifact |
| 107 | + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 |
| 108 | + |
| 109 | + deploy: |
| 110 | + environment: |
| 111 | + name: github-pages |
| 112 | + url: ${{ steps.deployment.outputs.page_url }} |
| 113 | + runs-on: ubuntu-latest |
| 114 | + needs: build-page |
| 115 | + steps: |
| 116 | + - name: Deploy to GitHub Pages |
| 117 | + id: deployment |
| 118 | + uses: actions/deploy-pages@decdde0ac072f6dcbe43649d82d9c635fff5b4e4 # v4.0.4 |
0 commit comments