ci/cd: enable centos 8 release

This commit is contained in:
Alex Diaz 2021-10-19 23:29:33 -04:00
parent bd536b8ae6
commit f5e85f3234
No known key found for this signature in database
GPG key ID: 5F95650F793D0948

View file

@ -4,32 +4,10 @@ on:
- v*
jobs:
fedora-release-rpm:
create-gh-release:
runs-on: ubuntu-latest
container: fedora:34
container: fedora:latest
steps:
- name: get version from tag
run: |
echo "RELEASE_VER=${GITHUB_REF#*/*/v}" >> ${GITHUB_ENV}
- uses: actions/checkout@v2
- name: install tools and dependencies
run: |
dnf install -y rpm-build findutils clang-tools-extra 'dnf-command(builddep)'
dnf builddep -y mouse_m908.spec
- name: build mouse_m908 rpm package
run: |
make -j4 rpm
make -j4 src-rpm
- name: upload rpm package artifact
uses: actions/upload-artifact@v2
with:
name: mouse_m908-${{ github.run_id }}-1.x86_64.rpm
path: mouse_m908-${{ env.RELEASE_VER }}-1.x86_64.rpm
- name: upload src rpm package artifact
uses: actions/upload-artifact@v2
with:
name: mouse_m908-${{ github.run_id }}.src.rpm
path: mouse_m908-${{ env.RELEASE_VER }}-1.src.rpm
- name: create release
id: create_release
uses: actions/create-release@v1
@ -40,15 +18,66 @@ jobs:
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: put upload_url in artifact
run: |
echo '${{ steps.create_release.outputs.upload_url }}' > release-upload-url
- name: upload artifact
uses: actions/upload-artifact@v2
with:
name: release-upload-url
path: release-upload-url
fedora-release-rpm:
runs-on: ubuntu-latest
container: fedora:34
steps:
- uses: actions/checkout@v2
- name: get version details
run: |
echo "RELEASE_VER=${GITHUB_REF#*/*/v}" >> ${GITHUB_ENV}
echo "DIST_TAG=$(rpm --eval '%dist')" >> ${GITHUB_ENV}
echo "RPM_RELEASE=$(awk '/Release:/{$0 = $2; FS="%"; $0=$0; print $1}' mouse_m908.spec)" >> ${GITHUB_ENV}
- name: set output variables
run: |
echo "RPM_NAME=mouse_m908-${RELEASE_VER}-${RPM_RELEASE}${DIST_TAG}.x86_64.rpm" >> ${GITHUB_ENV}
echo "SRPM_NAME=mouse_m908-${RELEASE_VER}-${RPM_RELEASE}${DIST_TAG}.src.rpm" >> ${GITHUB_ENV}
- name: install tools and dependencies
run: |
dnf install -y rpm-build findutils clang-tools-extra 'dnf-command(builddep)'
dnf builddep -y mouse_m908.spec
- name: build mouse_m908 rpm package
run: |
make -j4 rpm
make -j4 src-rpm
- name: upload rpm package artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.RPM_NAME }}
path: ${{ env.RPM_NAME }}
- name: upload src rpm package artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.SRPM_NAME }}
path: ${{ env.SRPM_NAME }}
- name: download release-upload-url artifact
uses: actions/download-artifact@v2
with:
name: release-upload-url
path: release-upload-url
- name: set upload url environment var
run: |
echo "UPLOAD_URL=$(cat release-upload-url/release-upload-url)" >> ${GITHUB_ENV}
- name: upload rpm package to release page
id: upload-release-rpm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./mouse_m908-${{ env.RELEASE_VER }}-1.x86_64.rpm
asset_name: mouse_m908-${{ env.RELEASE_VER }}-1.x86_64.rpm
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./${{ env.RPM_NAME }}
asset_name: ${{ env.RPM_NAME }}
asset_content_type: application/octet-stream
- name: upload src rpm package to release page
id: upload-release-srpm
@ -56,7 +85,71 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./mouse_m908-${{ env.RELEASE_VER }}-1.src.rpm
asset_name: mouse_m908-${{ env.RELEASE_VER }}-1.src.rpm
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./${{ env.SRPM_NAME }}
asset_name: ${{ env.SRPM_NAME }}
asset_content_type: application/octet-stream
centos-release-rpm:
runs-on: ubuntu-latest
container: centos:8
steps:
- uses: actions/checkout@v2
- name: get version details
run: |
echo "RELEASE_VER=${GITHUB_REF#*/*/v}" >> ${GITHUB_ENV}
echo "DIST_TAG=$(rpm --eval '%dist')" >> ${GITHUB_ENV}
echo "RPM_RELEASE=$(awk '/Release:/{$0 = $2; FS="%"; $0=$0; print $1}' mouse_m908.spec)" >> ${GITHUB_ENV}
- name: set output variables
run: |
echo "RPM_NAME=mouse_m908-${RELEASE_VER}-${RPM_RELEASE}${DIST_TAG}.x86_64.rpm" >> ${GITHUB_ENV}
echo "SRPM_NAME=mouse_m908-${RELEASE_VER}-${RPM_RELEASE}${DIST_TAG}.src.rpm" >> ${GITHUB_ENV}
- name: install tools and dependencies
run: |
dnf install -y rpm-build findutils clang-tools-extra 'dnf-command(builddep)' 'dnf-command(config-manager)'
dnf config-manager --set-enabled powertools
dnf builddep -y mouse_m908.spec
- name: build mouse_m908 rpm package
run: |
make -j4 rpm
make -j4 src-rpm
- name: upload rpm package artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.RPM_NAME }}
path: ${{ env.RPM_NAME }}
- name: upload src rpm package artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.SRPM_NAME }}
path: ${{ env.SRPM_NAME }}
- name: download release-upload-url artifact
uses: actions/download-artifact@v2
with:
name: release-upload-url
path: release-upload-url
- name: set upload url environment var
run: |
echo "UPLOAD_URL=$(cat release-upload-url/release-upload-url)" >> ${GITHUB_ENV}
- name: upload rpm package to release page
id: upload-release-rpm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./${{ env.RPM_NAME }}
asset_name: ${{ env.RPM_NAME }}
asset_content_type: application/octet-stream
- name: upload src rpm package to release page
id: upload-release-srpm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./${{ env.SRPM_NAME }}
asset_name: ${{ env.SRPM_NAME }}
asset_content_type: application/octet-stream