Skip to content

Commit e43d472

Browse files
authored
chore(ci): always deploy docs (#7484)
1 parent 3fe83cb commit e43d472

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,56 @@ jobs:
2828
with:
2929
script: |
3030
try {
31-
await github.rest.actions.downloadArtifact({
31+
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
3232
owner: context.repo.owner,
3333
repo: context.repo.repo,
34-
run_id: context.payload.workflow_run.id,
35-
github_token: ${{ secrets.GITHUB_TOKEN }},
36-
artifact_name: 'artifact-docs',
37-
output_path: 'packages/docs'
34+
run_id: context.payload.workflow_run.id
3835
});
36+
const hasDocsArtifact = artifacts.data.artifacts.some(a => a.name === 'artifact-docs');
37+
core.setOutput('has-docs', hasDocsArtifact);
38+
// Always return success from this script
3939
return true;
4040
} catch (error) {
41-
return false;
41+
console.error('Error checking for artifacts:', error);
42+
core.setOutput('has-docs', false);
43+
// Always return success from this script
44+
return true;
4245
}
4346
4447
- name: Checkout code
45-
if: ${{ steps.check-artifact.outcome == 'success' }}
48+
if: ${{ steps.check-artifact.outputs['has-docs'] == true }}
4649
uses: actions/checkout@v4
4750

51+
- name: Download docs artifact
52+
if: ${{ steps.check-artifact.outputs['has-docs'] == true }}
53+
uses: actions/download-artifact@v4
54+
with:
55+
name: artifact-docs
56+
github-token: ${{ secrets.GITHUB_TOKEN }}
57+
run-id: ${{ github.event.workflow_run.id }}
58+
path: packages/docs
59+
60+
- name: Verify dist directory exists
61+
if: ${{ steps.check-artifact.outputs['has-docs'] == true }}
62+
run: |
63+
ls -la packages/docs
64+
if [ ! -d "packages/docs/dist" ]; then
65+
echo "Creating dist directory"
66+
mkdir -p packages/docs/dist
67+
cp -r packages/docs/* packages/docs/dist/ || true
68+
fi
69+
4870
# not the official version, so be careful when updating
4971
- name: Deploy to Cloudflare Pages
50-
if: ${{ steps.check-artifact.outcome == 'success' }}
72+
if: ${{ steps.check-artifact.outputs['has-docs'] == true }}
5173
uses: AdrianGonz97/refined-cf-pages-action@6c0d47ff7c97c48fa702b6d9f71f7e3a7c30c7d8
5274
with:
5375
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
5476
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
5577
projectName: 'qwik-docs'
5678
directory: packages/docs/dist
5779
githubToken: ${{ secrets.GITHUB_TOKEN }}
80+
81+
- name: Skip message when no docs artifact
82+
if: ${{ steps.check-artifact.outputs['has-docs'] != true }}
83+
run: echo "No docs artifact found, skipping deployment"

0 commit comments

Comments
 (0)