Skip to content

Get ready for refreshing just with access tokens #38

Get ready for refreshing just with access tokens

Get ready for refreshing just with access tokens #38

Workflow file for this run

---
name: Create packages and release
on:
pull_request:
types:
- closed
jobs:
prepare-release:
name: Prepare Release
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
outputs:
version: ${{ steps.extract-version.outputs.version }}
changelog: ${{ steps.extract-changelog.outputs.markdown }}
steps:
- uses: actions/checkout@v4
- name: Extract version
id: extract-version
run: |
# this uses GNU sed -z!
version=$(grep "^## \[[0-9].*\]" CHANGELOG | \
head -1 | sed -e "s/^.*\[\(.*\)\].*/\1/")
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Extract changelog
id: extract-changelog
uses: sean0x42/markdown-extract@v2
with:
file: CHANGELOG
pattern: ${{ steps.extract-version.outputs.version }}
no-print-matched-heading: true
sdist:
name: build python sdist
needs: prepare-release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
- name: Build sdist
run: |
pip install tox
python setup.py sdist
- name: Get version
id: version
run: echo "version=$(python setup.py --version)" >> "$GITHUB_OUTPUT"
- name: Upload output file
uses: actions/upload-artifact@v3
with:
name: sdist
path: dist/*tar.gz
centos7:
name: build centos 7 rpms
needs: sdist
runs-on: ubuntu-latest
container: centos:7
steps:
- uses: actions/download-artifact@v3
with:
name: sdist
- name: install build requisites
run: |
yum install -y rpm-build rpmlint
yum install -y centos-release-openstack-queens
yum install -y python-pbr python-setuptools
- name: build rpm
run: |
tar -xzf cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz \
--strip-components 1 cloud_info_provider-${{ needs.sdist.outputs.version }}/rpm
sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" rpm/cloud-info-provider.spec
sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" rpm/cloud-info-provider-opennebula.spec
sed -i "s/^\(Version.\).*/\\1 ${{ needs.sdist.outputs.version }}/" rpm/cloud-info-provider-openstack.spec
mkdir -p {BUILD,RPMS,SOURCES,SPECS,SRPMS}
cp -v cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz SOURCES
rpmbuild --define "_topdir $PWD" -ba rpm/cloud-info-provider.spec
rpmbuild --define "_topdir $PWD" -ba rpm/cloud-info-provider-openstack.spec
rpmbuild --define "_topdir $PWD" -ba rpm/cloud-info-provider-opennebula.spec
rpmlint RPMS/noarch/*.rpm
- name: Upload rpms
uses: actions/upload-artifact@v3
with:
name: rpms
path: |
RPMS/noarch/cloud-info-provider-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm
RPMS/noarch/cloud-info-provider-opennebula-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm
RPMS/noarch/cloud-info-provider-openstack-${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm
ubuntu:
name: build debs
needs: sdist
runs-on: ubuntu-latest
container: ubuntu:xenial
steps:
- uses: actions/download-artifact@v3
with:
name: sdist
- name: install build requistes
run: |
apt-get update -q
apt-get install -q -y devscripts debhelper git
apt-get install -q -y python-all-dev python-pbr python-setuptools
- name: build packages
run: |
tar -xzf cloud_info_provider-${{ needs.sdist.outputs.version }}.tar.gz \
--strip-components 1
sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" debian/changelog
debuild --no-tgz-check clean binary
cd debs/cloud-info-provider-openstack
sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" debian/changelog
debuild --no-tgz-check clean binary
cd ../../debs/cloud-info-provider-opennebula
sed -i -e "1s/(.*)/(${{ needs.sdist.outputs.version }}-1)/" debian/changelog
debuild --no-tgz-check clean binary
cd ../..
mv debs/*.deb .
mv ../*.deb .
- name: Upload debs
uses: actions/upload-artifact@v3
with:
name: debs
path: |
python-cloud-info-provider_${{ needs.sdist.outputs.version }}-1_all.deb
python-cloud-info-provider-opennebula_${{ needs.sdist.outputs.version }}-1_all.deb
python-cloud-info-provider-openstack_${{ needs.sdist.outputs.version }}-1_all.deb
release:
needs: [sdist, ubuntu, centos7, prepare-release]
name: Upload release artefacts
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: debs
- uses: actions/download-artifact@v3
with:
name: rpms
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.prepare-release.outputs.version }}
name: Release ${{ needs.prepare-release.outputs.version }}
body: '${{ needs.prepare-release.outputs.changelog }}'
files: |
cloud-info-provider*${{ needs.sdist.outputs.version }}-1.el7.noarch.rpm
python-cloud-info-provider*${{ needs.sdist.outputs.version }}-1_all.deb