| 1 | + | # g1t's reusable deploy workflow: what the deploy workflow g1t manages for |
| 2 | + | # a project calls (crates/actions/src/managed.rs), as |
| 3 | + | # `g1t/workflows/.g1t/workflows/deploy.yml@v1`. Any workflow can call it |
| 4 | + | # the same way. It checks out the commit and builds it onto g1t.page with |
| 5 | + | # g1t/deploy: production from the project's production branch, a preview |
| 6 | + | # from a pull request or another branch. |
| 7 | + | # |
| 8 | + | # Its job is named `deploy`, so a caller job named `g1t` reports the |
| 9 | + | # check `g1t / deploy`. |
| 10 | + | name: g1t deploy |
| 11 | + | |
| 12 | + | on: |
| 13 | + | workflow_call: |
| 14 | + | inputs: |
| 15 | + | project: |
| 16 | + | description: The project's slug; the repository's one project with Deployments on when empty. |
| 17 | + | type: string |
| 18 | + | default: "" |
| 19 | + | root-dir: |
| 20 | + | description: Where the project is in the repository; the project's own setting when empty. |
| 21 | + | type: string |
| 22 | + | default: "" |
| 23 | + | build-command: |
| 24 | + | description: What builds it; the project's own setting, else what the build finds. |
| 25 | + | type: string |
| 26 | + | default: "" |
| 27 | + | output-dir: |
| 28 | + | description: The folder a static build writes; found by itself when empty. |
| 29 | + | type: string |
| 30 | + | default: "" |
| 31 | + | outputs: |
| 32 | + | url: |
| 33 | + | description: Where the app is served, on g1t.page. |
| 34 | + | value: ${{ jobs.deploy.outputs.url }} |
| 35 | + | |
| 36 | + | jobs: |
| 37 | + | deploy: |
| 38 | + | name: deploy |
| 39 | + | runs-on: ubuntu-latest |
| 40 | + | timeout-minutes: 30 |
| 41 | + | # A pull request from a fork gets a read-only token, as on GitHub; g1t |
| 42 | + | # still builds its preview, without the project's build secrets. |
| 43 | + | permissions: |
| 44 | + | contents: read |
| 45 | + | deployments: write |
| 46 | + | outputs: |
| 47 | + | url: ${{ steps.deploy.outputs.url }} |
| 48 | + | steps: |
| 49 | + | - uses: actions/checkout@v5 |
| 50 | + | - id: deploy |
| 51 | + | uses: g1t/deploy@v1 |
| 52 | + | with: |
| 53 | + | project: ${{ inputs.project }} |
| 54 | + | root-dir: ${{ inputs.root-dir }} |
| 55 | + | build-command: ${{ inputs.build-command }} |
| 56 | + | output-dir: ${{ inputs.output-dir }} |