I am attempting to deploy pages with the specified configuration, an error occurred due to the absence of any uploaded artifact. The deployment process couldn't find the artifact named "coverage-report"
as specified in the deployment action. But in the pipeline and in output i can see that there is an artifact uploaded with the name of "coverage-report"
, even the Artifact ID is also created.
This is my pipeline logs:-
> Run actions/upload-artifact@v4
With the provided path, there will be 1 file uploaded
Artifact 'coverage-report' (ID: 1512371137) deleted
Artifact name is valid!
Root directory input is valid!
Beginning upload of artifact content to blob storage
Uploaded bytes 3503
Finished uploading artifact content to blob storage!
SHA256 hash of uploaded artifact zip is 16b48eb6ed684e0aba7f41fff8da8ed05e28183b97c4c08f19c0b6aa063caf0c
Finalizing artifact upload
Artifact coverage-report.zip successfully finalized. Artifact ID 1518618736
Artifact coverage-report has been successfully uploaded! Final size is 3503 bytes. Artifact ID is 1518618736
Artifact download URL: https://github.com/Sonichigo/mux-postgresQL/actions/runs/9123784355/artifacts/1518618736
> Run actions/deploy-pages@v3
with:
artifact_name: coverage-report
token: ***
timeout: 600000
error_count: 10
reporting_interval: 5000
preview: false
Artifact exchange URL: https://pipelinesghubeus10.actions.githubusercontent.com/RyaceIjGjj5Wyj3ugxgIox9jX04VXetUleDwfBLlpVjSqp5WgH/_apis/pipelines/workflows/9123784355/artifacts?api-version=6.0-preview
Error: Error: No uploaded artifact was found! Please check if there are any errors at build step, or uploaded artifact name is correct.
at getSignedArtifactMetadata (/home/runner/work/_actions/actions/deploy-pages/v3/src/internal/api-client.js:94:1)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Deployment.create (/home/runner/work/_actions/actions/deploy-pages/v3/src/internal/deployment.js:68:1)
at main (/home/runner/work/_actions/actions/deploy-pages/v3/src/index.js:30:1)
This is my custom action.yml
outputs:
coverage-report-file:
description: 'Path to the generated coverage report file'
value: ${{ steps.generate-report.outputs.report-file }}
runs:
using: 'composite'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22.*
- name: Generate coverage report
id: generate-report
run: |
PKG_DIR="${{ inputs.package-directory || './...' }}"
COVERAGE_FILE="${{ inputs.coverage-file || 'coverage-report' }}"
go test -race -coverprofile=$COVERAGE_FILE.out $PKG_DIR
go tool cover -html=$COVERAGE_FILE.out -o $COVERAGE_FILE.html
COVERAGE_PERCENTAGE=$(go tool cover -func=$COVERAGE_FILE.out | grep total: | awk '{print substr($3, 1, length($3)-1)}')
if (( $(echo "$COVERAGE_PERCENTAGE < ${{ inputs.coverage-threshold }}" | bc -l) )); then
echo "Error: Coverage $COVERAGE_PERCENTAGE% is below the required threshold of ${{ inputs.coverage-threshold }}%"
exit 1
fi
echo "report-file=$COVERAGE_FILE.html" >> $GITHUB_OUTPUT
shell: bash
- name: Upload coverage report artifact
id: upload-artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ${{ steps.generate-report.outputs.report-file }}
overwrite: true
retention-days: 4
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
with:
artifact_name: coverage-report
token: ${{ github.token }}
After updating the version of deploy-page to v4 from v3, the artifact is found but it's not able to deploy the pages, here are by debug logs:-
##[debug]}
Found 6 artifact(s)
##[debug]List artifact count: 1
##[debug]Artifact: {"name":"coverage-report","id":1521553372,"size":3503,"createdAt":"2024-05-21T05:02:05.000Z"}
Creating Pages deployment with payload:
{
"artifact_id": 1521553372,
"pages_build_version": "d342d0b590a3c5b2b61582d58165336bff9eeab6",
"oidc_token": "***"
}
Created deployment for d342d0b590a3c5b2b61582d58165336bff9eeab6, ID: d342d0b590a3c5b2b61582d58165336bff9eeab6
##[debug]{"id":"d342d0b590a3c5b2b61582d58165336bff9eeab6","page_url":"https://sonichigo.github.io/mux-postgresQL/","status_url":"https://api.github.com/repos/Sonichigo/mux-postgresQL/pages/deployment/status/d342d0b590a3c5b2b61582d58165336bff9eeab6","preview_url":""}
Getting Pages deployment status...
Error: Deployment failed, try again later.
##[debug]Node Action run completed with exit code 1
##[debug]Set output page_url = https://sonichigo.github.io/mux-postgresQL/
##[debug]Finished: run
##[debug]Evaluating condition for step: 'run'
This worked for me: -
- name: Upload coverage report artifact
id: upload-artifact
uses: actions/upload-pages-artifact@main
with:
name: github-pages
- name: Deploy to GitHub Pages
id: deployment
if: ${{ github.event_name == 'pull_request' }}
uses: actions/deploy-pages@v4
env:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
with:
artifact_name: github-pages
token: ${{ github.token }}
preview: true
So the deployment was failing due to some issue with the artifact contents/creation
. I got to know that the actions/upload-pages-artifact
action is recommended to be used here when aiming to deploy to Pages. Although if above action is used then, one extra is to delete the previous github artifact otherwise it would fail since it doesn't have overwrite flag which was present in upload-artifact
.