Skip to content

Commit

Permalink
Update Docker workflow to workaround upload action changes
Browse files Browse the repository at this point in the history
  • Loading branch information
admdly committed Dec 18, 2023
1 parent fa4a4a4 commit 8cdd61a
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,48 @@ jobs:
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: 'Upload Digest'
- name: 'Check if Digests Artifact Exists and Merge'
uses: actions/github-script@v7
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: owner,
repo: repo,
run_id: context.runId,
name: 'digests'
});
if (artifacts.data.total_count > 0) {
console.log('Digests artifact already uploaded - retrieving.');
const digests = await github.rest.actions.downloadArtifact({
owner,
repo,
artifact_id: artifacts.data.artifacts[0].id,
archive_format: 'zip'
});
require('fs').writeFileSync('/tmp/digests.zip', Buffer.from(digests.data));
require('child_process').execSync(`unzip -o /tmp/digests.zip -d /tmp/digests`);
console.log('Deleting already uploaded digests artifact.')
const result = await github.rest.actions.deleteArtifact({
owner: owner,
repo: repo,
artifact_id: artifacts.data.artifacts[0].id
});
if (result.status == 204) {
return;
} else {
core.setFailed('Error occured deleting existing digests artifact');
}
} else {
return;
}
- name: 'Upload Digests'
uses: actions/upload-artifact@v4
with:
name: digests
Expand Down

0 comments on commit 8cdd61a

Please sign in to comment.