Skip to content

Commit

Permalink
upload both 7z/zip in github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sdcb committed Dec 20, 2024
1 parent 9457bb9 commit 76a67c2
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,27 +348,31 @@ jobs:
name: ${{ matrix.asset }}
path: ${{ matrix.asset }}
- name: Compress artifacts into 7z
- name: Compress artifacts
run: |
7z a ${{ matrix.asset }}.7z ${{ matrix.asset }}
zip -r ${{ matrix.asset }}.zip ${{ matrix.asset }}
shell: bash
- name: Upload Asset
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const assetPath = './${{ matrix.asset }}.7z';
const assetNames = [ '${{ matrix.asset }}.7z', '${{ matrix.asset }}.zip' ];
const releaseId = "${{ needs.create-release.outputs.release_id }}";
const asset = fs.readFileSync(assetPath);
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: releaseId,
name: '${{ matrix.asset }}.7z',
data: asset,
const promises = assetNames.map(assetName => {
const asset = fs.readFileSync('./' + assetName);
return github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: releaseId,
name: assetName,
data: asset,
});
});
await Promise.all(promises);
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit 76a67c2

Please sign in to comment.