@@ -28,30 +28,56 @@ jobs:
28
28
with :
29
29
script : |
30
30
try {
31
- await github.rest.actions.downloadArtifact ({
31
+ const artifacts = await github.rest.actions.listWorkflowRunArtifacts ({
32
32
owner: context.repo.owner,
33
33
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
38
35
});
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
39
39
return true;
40
40
} 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;
42
45
}
43
46
44
47
- name : Checkout code
45
- if : ${{ steps.check-artifact.outcome == 'success' }}
48
+ if : ${{ steps.check-artifact.outputs['has-docs'] == true }}
46
49
uses : actions/checkout@v4
47
50
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
+
48
70
# not the official version, so be careful when updating
49
71
- name : Deploy to Cloudflare Pages
50
- if : ${{ steps.check-artifact.outcome == 'success' }}
72
+ if : ${{ steps.check-artifact.outputs['has-docs'] == true }}
51
73
uses : AdrianGonz97/refined-cf-pages-action@6c0d47ff7c97c48fa702b6d9f71f7e3a7c30c7d8
52
74
with :
53
75
apiToken : ${{ secrets.CLOUDFLARE_API_TOKEN }}
54
76
accountId : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
55
77
projectName : ' qwik-docs'
56
78
directory : packages/docs/dist
57
79
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