Skip to content

Commit

Permalink
Merge pull request #699 from leancodepl/fix-gha
Browse files Browse the repository at this point in the history
Use new download/upload-artifact Github Action
  • Loading branch information
jakubfijalkowski authored Sep 10, 2024
2 parents 8ec8dc5 + b28a118 commit 5b2614b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/core_build_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
zip -j "$ZIP" "$PWD"/packed/*.nupkg
- name: Publish artifacts
if: ${{ needs.prepare.outputs.publish_artifacts == '1' }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ needs.prepare.outputs.artifacts_name }}
path: ${{ needs.prepare.outputs.artifacts_name }}
Expand Down Expand Up @@ -186,7 +186,7 @@ jobs:

- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Unit Test Results
path: test/TestResults/*.xml
Expand All @@ -199,7 +199,7 @@ jobs:
steps:
- name: Fetch build
id: download
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: ${{ needs.prepare.outputs.artifacts_name }}
- name: Unzip
Expand Down
27 changes: 3 additions & 24 deletions .github/workflows/publish_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,10 @@ jobs:

steps:
- name: Download Artifacts
uses: actions/github-script@v6
uses: dawidd6/action-download-artifact@v6
with:
script: |
var fs = require('fs');
var path = require('path');
var artifacts_path = path.join('${{github.workspace}}', 'artifacts');
fs.mkdirSync(artifacts_path, { recursive: true });
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
for (var artifact of artifacts.data.artifacts) {
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: 'zip',
});
var artifact_path = path.join(artifacts_path, `${artifact.name}.zip`);
fs.writeFileSync(artifact_path, Buffer.from(download.data));
console.log(`Downloaded ${artifact_path}`);
}
run_id: ${{ github.event.workflow_run.id }}
path: artifacts
- name: Extract Artifacts
run: |
for file in artifacts/*.zip; do
Expand Down

0 comments on commit 5b2614b

Please sign in to comment.