2021-07-12 19:20:11 -04:00
|
|
|
# GitHub actions workflow which builds the release artifacts.
|
2021-07-12 14:03:14 -04:00
|
|
|
|
2021-07-12 19:20:11 -04:00
|
|
|
name: Build release artifacts
|
2021-07-12 14:03:14 -04:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-07-12 19:20:11 -04:00
|
|
|
# we build on develop and release branches to (hopefully) get early warning
|
|
|
|
# of things breaking
|
2021-07-12 14:03:14 -04:00
|
|
|
branches: ["develop", "release-*"]
|
|
|
|
|
2021-07-12 19:20:11 -04:00
|
|
|
# we also rebuild on tags, so that we can be sure of picking the artifacts
|
|
|
|
# from the right tag.
|
|
|
|
tags: ["v*"]
|
|
|
|
|
2021-07-12 14:03:14 -04:00
|
|
|
permissions:
|
2021-07-13 06:50:14 -04:00
|
|
|
contents: write
|
2021-07-12 14:03:14 -04:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
# first get the list of distros to build for.
|
|
|
|
get-distros:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
- id: set-distros
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=distros::$(scripts-dev/build_debian_packages --show-dists-json)"
|
|
|
|
# map the step outputs to job outputs
|
|
|
|
outputs:
|
|
|
|
distros: ${{ steps.set-distros.outputs.distros }}
|
|
|
|
|
|
|
|
# now build the packages with a matrix build.
|
|
|
|
build-debs:
|
|
|
|
needs: get-distros
|
|
|
|
name: "Build .deb packages"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
distro: ${{ fromJson(needs.get-distros.outputs.distros) }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
path: src
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
- run: ./src/scripts-dev/build_debian_packages "${{ matrix.distro }}"
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2021-07-12 19:20:11 -04:00
|
|
|
name: debs
|
2021-07-12 14:03:14 -04:00
|
|
|
path: debs/*
|
2021-07-12 19:20:11 -04:00
|
|
|
|
|
|
|
build-sdist:
|
|
|
|
name: "Build pypi distribution files"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
- run: pip install wheel
|
|
|
|
- run: |
|
|
|
|
python setup.py sdist bdist_wheel
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: python-dist
|
|
|
|
path: dist/*
|
2021-07-13 06:50:14 -04:00
|
|
|
|
|
|
|
# if it's a tag, create a release and attach the artifacts to it
|
|
|
|
attach-assets:
|
|
|
|
name: "Attach assets to release"
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
needs:
|
|
|
|
- build-debs
|
|
|
|
- build-sdist
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Download all workflow run artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
- name: Build a tarball for the debs
|
|
|
|
run: tar -cvJf debs.tar.xz debs
|
|
|
|
- name: Attach to release
|
|
|
|
uses: softprops/action-gh-release@a929a66f232c1b11af63782948aa2210f981808a # PR#109
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
python-dist/*
|
|
|
|
debs.tar.xz
|
|
|
|
# if it's not already published, keep the release as a draft.
|
|
|
|
draft: true
|
|
|
|
# mark it as a prerelease if the tag contains 'rc'.
|
|
|
|
prerelease: ${{ contains(github.ref, 'rc') }}
|