Skip to content

Commit

Permalink
Update build-wheel.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
williamjacksn committed Feb 23, 2023
1 parent eda826d commit 34b7771
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/build-wheel.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# template version 2022.4
# template version 2023.2

name: Build Python wheel for Alpine Linux

Expand All @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
image_tag:
- 3.10-alpine
- 3.11-alpine

steps:

Expand All @@ -33,24 +33,30 @@ jobs:
- name: Get file name and sha256 of asset
id: asset
run: |
echo "::set-output name=package_name::$(awk -F '==' '{ print $1 }' requirements.txt)"
echo "::set-output name=filename::$(ls *.whl)"
echo "::set-output name=sha256::$(shasum -a 256 *.whl | awk '{ print $1 }')"
echo "package_name=$(awk -F '==' '{ print $1 }' requirements.txt)" >> $GITHUB_OUTPUT
echo "filename=$(ls *.whl)" >> $GITHUB_OUTPUT
echo "sha256=$(shasum -a 256 *.whl | awk '{ print $1 }')" >> $GITHUB_OUTPUT
- name: Show sha256 of asset
run: shasum -a 256 ${{ github.workspace }}/${{ steps.asset.outputs.filename }}

- name: Upload asset to release
id: upload
if: github.event_name == 'release'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
uses: actions/github-script@v6
with:
asset_content_type: application/octet-stream
asset_path: ${{ github.workspace }}/${{ steps.asset.outputs.filename }}
asset_name: ${{ steps.asset.outputs.filename }}
upload_url: ${{ github.event.release.upload_url }}
script: |
const fs = require('node:fs/promises');
const data = await fs.readFile('${{ github.workspace }}/${{ steps.asset.outputs.filename }}');
const repository = '${{ github.repository }}';
const { data: releaseAsset } = await github.rest.repos.uploadReleaseAsset({
owner: '${{ github.repository_owner }}',
repo: repository.split('/')[1],
release_id: '${{ github.event.release.id }}',
name: '${{ steps.asset.outputs.filename }}',
data: data
});
core.setOutput('browser_download_url', releaseAsset.browser_download_url);
- name: Send repository dispatch to package index
if: github.event_name == 'release'
Expand Down

0 comments on commit 34b7771

Please sign in to comment.