Skip to content
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

ci: updated to actions/upload-artifact v4 #574

Merged
merged 2 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions .github/workflows/comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,30 @@ jobs:
uses: actions/github-script@v7
with:
script: |
var fs = require('fs');
var child_process = require('child_process');
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "screenshots"
})[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
var matchingArtifacts = artifacts.data.artifacts.filter((artifact) => {
return artifact.name.startsWith("screenshots-");
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/screenshots.zip', Buffer.from(download.data));

- run: unzip -d screenshots screenshots.zip
for (const artifact of matchingArtifacts) {
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: 'zip',
});
fs.writeFileSync(`${{github.workspace}}/${artifact.name}.zip`, Buffer.from(download.data));
// Unzip the artifact
child_process.execSync(`unzip -d screenshots ${artifact.name}.zip`, {cwd: process.env.GITHUB_WORKSPACE});
// Remove the zip file
fs.unlinkSync(`${{github.workspace}}/${artifact.name}.zip`);
}

- name: Compose comment
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ jobs:
mv screenshots/*.png screenshots/dist/$aw_server/$aw_version
- name: Upload screenshots
if: ${{ success() || steps.e2e.conclusion == 'failure'}}
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4
with:
name: screenshots
name: screenshots-${{ matrix.aw-server }}-${{ matrix.aw-version }}
path: screenshots/dist/*
- name: Print server logs to console
if: ${{ always() }}
Expand Down
Loading