v0.22.2 #7
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build .rpm packages | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to build (e.g. 0.20.0)" | |
| required: true | |
| jobs: | |
| build-rpm: | |
| runs-on: ubuntu-latest | |
| container: rockylinux:9 | |
| permissions: | |
| contents: write | |
| env: | |
| GH_REPO: ${{ github.repository }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install build dependencies | |
| run: | | |
| dnf install -y \ | |
| python3.12 python3.12-devel \ | |
| ruby ruby-devel gcc make rpm-build \ | |
| libxml2-devel libxslt-devel openssl-devel libffi-devel \ | |
| git-core | |
| - name: Install gh CLI | |
| run: | | |
| dnf install -y dnf-plugins-core | |
| dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo | |
| dnf install -y gh | |
| - name: Install fpm | |
| run: gem install fpm --no-document | |
| - name: Determine version | |
| id: version | |
| run: | | |
| if [ -n "${{ inputs.version }}" ]; then | |
| echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build virtualenv | |
| run: | | |
| python3.12 -m venv /opt/venvs/junos-ops | |
| /opt/venvs/junos-ops/bin/python -m ensurepip --upgrade 2>/dev/null || true | |
| /opt/venvs/junos-ops/bin/pip install --upgrade pip setuptools | |
| /opt/venvs/junos-ops/bin/pip install "${GITHUB_WORKSPACE}" | |
| /opt/venvs/junos-ops/bin/junos-ops --version | |
| - name: Prepare staging directory | |
| run: | | |
| mkdir -p staging/opt/venvs staging/usr/bin | |
| cp -a /opt/venvs/junos-ops staging/opt/venvs/ | |
| ln -s /opt/venvs/junos-ops/bin/junos-ops staging/usr/bin/junos-ops | |
| - name: Build .rpm package | |
| env: | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| fpm -s dir -t rpm \ | |
| -C staging \ | |
| -n junos-ops \ | |
| -v "${VERSION}" \ | |
| --iteration 1.el9 \ | |
| --license "Apache-2.0" \ | |
| --vendor "AIKAWA Shigechika" \ | |
| --maintainer "AIKAWA Shigechika <shigechika@users.noreply.github.com>" \ | |
| --url "https://github.com/shigechika/junos-ops" \ | |
| --description "Automated JUNOS package management for Juniper Networks devices" \ | |
| --rpm-summary "Automated JUNOS package management for Juniper Networks devices" \ | |
| --depends python3.12 \ | |
| --after-remove rpm/post-remove.sh \ | |
| . | |
| - name: Upload .rpm as artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: junos-ops-el9 | |
| path: "${{ github.workspace }}/*.rpm" | |
| retention-days: 7 | |
| - name: Upload .rpm to GitHub Release | |
| if: github.event_name == 'release' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release upload "${GITHUB_REF_NAME}" *.rpm --clobber |