diff --git a/.github/workflows/drive.yml b/.github/workflows/drive.yml index 3f2e0761..29a61429 100644 --- a/.github/workflows/drive.yml +++ b/.github/workflows/drive.yml @@ -21,16 +21,41 @@ jobs: echo "AGENT_VERSION=${AGENT_VERSION}" echo "COMPOSE_FILE=${COMPOSE_FILE}" - name: Download artifact - uses: actions/download-artifact@v4 + uses: actions/github-script@v6 with: - name: artifact + script: | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "artifact" + })[0]; + if (!matchArtifact) { + core.setFailed('No artifact found from the build workflow'); + return; + } + let download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + let fs = require('fs'); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/artifact.zip`, Buffer.from(download.data)); + - name: Unzip artifact + run: unzip artifact.zip - name: Return artifact JSON + - name: Debug path + run: | + ls -a id: return-artifact-json uses: actions/github-script@v6 with: script: | let fs = require('fs'); - let data = JSON.parse(fs.readFileSync('${process.env.GITHUB_WORKSPACE}/artifacts.json')); + let data = JSON.parse(fs.readFileSync('${process.env.GITHUB_WORKSPACE}/artifacts/artifacts.json')); return data; - name: Run docker-compose