Skip to content

🏭 Build and 🧪 Test k3s 💼 RPM #102

🏭 Build and 🧪 Test k3s 💼 RPM

🏭 Build and 🧪 Test k3s 💼 RPM #102

Workflow file for this run

name: 🏭 Build and 🧪 Test k3s 💼 RPM
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🔄 Checkout code
uses: actions/checkout@v3
- name: 🧰 Setup RPMBuild environment
run: |
sudo apt-get install rpm
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
- name: ⬇️ Download k3s binary
run: |
curl -L -o ~/rpmbuild/SOURCES/k3s https://github.com/k3s-io/k3s/releases/latest/download/k3s
- name: 🏭 Build RPM
run: |
cp src/scripts/* ~/rpmbuild/SOURCES/
cp src/k3s.spec ~/rpmbuild/SPECS/k3s.spec
rpmbuild -ba ~/rpmbuild/SPECS/k3s.spec
- name: 🚚 Temporarily store RPM
uses: actions/upload-artifact@v3
with:
name: k3s
path: ~/rpmbuild/RPMS/**/*.rpm
test:
needs: build
runs-on: ubuntu-latest
steps:
- name: 📥 Download RPM
uses: actions/download-artifact@v3
with:
name: k3s
# - name: Display structure of downloaded files
# run: ls -R
- name: 💼 Install RPM and 🧪 Test k3s
run: docker run --name fedora -v ${{ github.workspace }}/x86_64/:/rpms fedora bash -c "dnf install -y /rpms/k3s-*.rpm && k3s --version"
release:
needs: test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 📥 Download RPM
uses: actions/download-artifact@v3
with:
name: k3s
- name: 📤 Upload RPM to GitHub Releases
uses: softprops/action-gh-release@v1
with:
files: |
${{ github.workspace }}/x86_64/k3s-*.rpm
body: |
k3s RPM built from commit ${{ github.sha }}
tag_name: 'main'
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
# - name: 📤 Upload RPM to GitHub Releases
# uses: actions/upload-release-asset@v1
# with:
# upload_url: ${{ github.event.release.upload_url }}
# asset_path: ${{ github.workspace }}/x86_64/k3s-*.rpm
# asset_name: k3s-*.rpm
# asset_content_type: application/x-rpm