-
Notifications
You must be signed in to change notification settings - Fork 16
[CI]: Restructure and Standardize the preview-deploy workflow across repos subscribed to the meshery-academy topic.
#36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
d9ff6af
7ac4585
6078385
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: preview-build-pr | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [master] | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: preview-build-pr-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| permissions: | ||
| contents: read | ||
| # Local reference for now; point at the central repo once published: | ||
| # uses: <org>/<central-repo>/.github/workflows/preview-build.yml@<pinned-sha> | ||
| uses: ./.github/workflows/preview-build.yml | ||
| with: | ||
| deployment-url: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: preview-build | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| deployment-url: | ||
| description: Base URL of the calling repo's GitHub Pages site, no trailing slash (e.g. https://owner.github.io/repo). | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: {} | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| build: | ||
| if: github.event_name == 'pull_request' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I may be mistaken, but I suspect this condition could always evaluate to My understanding is that when a workflow is invoked through If that is the case, then: if: github.event_name == 'pull_request'would evaluate to Even when the caller workflow itself is triggered by github.event_name == 'workflow_call'so the condition above would remain Could we confirm this behavior? If it is correct, it might be better to remove the condition and let the caller workflow decide when to invoke the reusable workflow. |
||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout PR code | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | ||
| with: | ||
| go-version-file: go.mod | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | ||
| with: | ||
| node-version: '22' | ||
| cache: npm | ||
|
|
||
| - name: Setup Hugo | ||
| uses: peaceiris/actions-hugo@2752ce1d29631191ea3f27c23495fa06139a5b78 # v3.2.1 | ||
| with: | ||
| hugo-version: '0.158.0' | ||
| extended: true | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Build preview | ||
| env: | ||
| BASE_URL: ${{ inputs.deployment-url }}/pr-preview/pr-${{ github.event.pull_request.number }}/ | ||
| run: | | ||
| set -euo pipefail | ||
| hugo \ | ||
| --cleanDestinationDir \ | ||
| --environment dev \ | ||
| --buildDrafts \ | ||
| --buildFuture \ | ||
| --buildExpired \ | ||
| --minify \ | ||
| --baseURL "$BASE_URL" | ||
|
|
||
| - name: Upload preview artifact | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: preview-site | ||
| path: public | ||
| retention-days: 1 | ||
| if-no-files-found: error | ||
Uh oh!
There was an error while loading. Please reload this page.