Skip to content

Workflow file for this run

# template version 2024.2
name: Build Python wheel for Alpine Linux
on:
pull_request:
branches:
- master
release:
types:
- published
jobs:
build:
name: Build Python wheel for Alpine Linux
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
image_tag:
- 3.12-alpine
platform:
- linux/amd64
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Run build script in Alpine container
run: docker compose run --no-TTY build
env:
IMAGE_TAG: ${{ matrix.image_tag }}
PLATFORM: ${{ matrix.platform }}
- name: Get file name and sha256 of asset
id: asset
run: |
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/github-script@v7
with:
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'
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.DISPATCH_TOKEN }}
repository: alpine-wheels/index
event-type: add_file
client-payload: '{"package_name": "${{ steps.asset.outputs.package_name }}", "href": "${{ steps.upload.outputs.browser_download_url }}", "hash_name": "sha256", "hash_value": "${{ steps.asset.outputs.sha256 }}"}'