Skip to content

Commit

Permalink
ci: updated to actions/upload-artifact v4 (#574)
Browse files Browse the repository at this point in the history
* ci: updated to actions/upload-artifact v4

* ci: fixed unzipping multiple screenshot artifacts
  • Loading branch information
ErikBjare authored May 11, 2024
1 parent 021acc4 commit 854b116
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
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

1 comment on commit 854b116

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are screenshots of this commit:

Screenshots using aw-server v0.12.3b18 (click to expand)

Screenshots using aw-server-rust master (click to expand)

Screenshots using aw-server-rust v0.12.3b18 (click to expand)

Please sign in to comment.