mirror of https://github.com/seebye/ueberzug
Build wheels for releases by using github actions.
pragmatic bash code to build and add wheels to releasespull/148/head
parent
24cb0a7be1
commit
31463ec815
@ -0,0 +1,64 @@
|
||||
name: Wheel builder
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published,edited]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: contains(github.event.release.body, '<!--build-->')
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
python-version: [3.7, 3.8, 3.9]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Creating environment variables
|
||||
run: |
|
||||
github_tag="${GITHUB_REF#refs/tags/}"
|
||||
echo "GITHUB_TAG=${github_tag}" >> "$GITHUB_ENV"
|
||||
echo "GITHUB_RELEASE_API_URL=${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/tags/${github_tag}" >> "$GITHUB_ENV"
|
||||
echo "GITHUB_TAG_FOLDER=tag_data" >> "$GITHUB_ENV"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt install -y libx11-dev libxext-dev libxres-dev jq
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install --upgrade wheel
|
||||
- name: Download release and extracting
|
||||
run: |
|
||||
code_archive_url="$(curl --header "Accept: application/vnd.github.v3+json" "${GITHUB_RELEASE_API_URL}" | jq --raw-output .zipball_url)"
|
||||
echo downloading "${code_archive_url}"
|
||||
wget --output-document="release.zip" "${code_archive_url}"
|
||||
# the folder name in the archive may change
|
||||
# so create a new folder so we can use globs
|
||||
# without having to fear the existence of other folders
|
||||
mkdir "${GITHUB_TAG_FOLDER}"
|
||||
cd "${GITHUB_TAG_FOLDER}"
|
||||
unzip ../release.zip
|
||||
- name: building
|
||||
run: |
|
||||
cd "${GITHUB_TAG_FOLDER}"/*/
|
||||
python setup.py bdist_wheel
|
||||
- name: uploading
|
||||
run: |
|
||||
upload_url="$(curl --header "Accept: application/vnd.github.v3+json" "${GITHUB_RELEASE_API_URL}" | jq --raw-output .upload_url)"
|
||||
upload_url="${upload_url%{*}"
|
||||
|
||||
cd "${GITHUB_TAG_FOLDER}"/*/
|
||||
for filename in dist/*; do
|
||||
echo uploading "${filename}"
|
||||
filename_encoded="$(printf '%s' "${filename#*/}" | jq --slurp --raw-input --raw-output @uri)"
|
||||
echo encoded filename "${filename_encoded}"
|
||||
curl --request POST \
|
||||
--header "Accept: application/vnd.github.v3+json" \
|
||||
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
|
||||
--header "Content-Type: application/octet-stream" \
|
||||
--data-binary @"${filename}" \
|
||||
"${upload_url}?name=${filename_encoded}"
|
||||
done
|
Loading…
Reference in New Issue