name: Core RPM Release on: push: tags: - 'release/core/*' permissions: code: read releases: write packages: write env: RPM_DISTRO_NAME: fedora RPM_DISTRO_VERSION: '43' jobs: build-core-rpm-release: runs-on: ubuntu-latest container: image: fedora:43 steps: # Build inside Fedora so the RPM package repository grouping matches the # Fedora release we publish to. - name: Install system dependencies run: | set -eu dnf install -y \ ca-certificates \ curl \ gcc \ gcc-c++ \ git \ make \ nodejs \ openssl-devel \ pkg-config \ python3 \ rpm-build \ sqlite-devel \ dbus-devel \ systemd-devel dnf clean all - name: Install Rust toolchain run: | set -eu curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y echo "/root/.cargo/bin" >> "$GITHUB_PATH" - name: Install cargo-generate-rpm run: cargo install cargo-generate-rpm - name: Check out repository code uses: actions/checkout@v3 with: fetch-depth: 0 - name: Build Core RPM working-directory: core run: make rpm - name: Read Core Package Version run: | set -eu version="$(awk -F ' = ' ' $0 == "[package]" { in_pkg = 1; next } /^\[/ { in_pkg = 0 } in_pkg && $1 == "version" { gsub(/"/, "", $2) print $2 exit } ' core/kordophoned/Cargo.toml)" if [ -z "$version" ]; then echo "Could not determine kordophoned package version from core/kordophoned/Cargo.toml." >&2 exit 1 fi printf 'CORE_PACKAGE_VERSION=%s\n' "$version" >> "$GITHUB_ENV" - name: Prepare release assets env: RELEASE_TAG: ${{ github.ref_name }} TAG_PREFIX: release/core/ ASSETS_DIR: ${{ gitea.workspace }}/release-assets/core RPM_BINARY_DIR: ${{ gitea.workspace }}/core/target/generate-rpm RPM_BINARY_PATTERN_PREFIX: kordophoned- RPM_PACKAGE_GROUP: ${{ vars.RPM_PACKAGE_GROUP }} RPM_DISTRO_NAME: ${{ env.RPM_DISTRO_NAME }} RPM_DISTRO_VERSION: ${{ env.RPM_DISTRO_VERSION }} EXPECTED_VERSION: ${{ env.CORE_PACKAGE_VERSION }} run: ./.gitea/scripts/prepare-rpm-release-assets.sh - name: Upload RPMs to Gitea package registry env: GITEA_SERVER_URL: ${{ gitea.server_url }} GITEA_REPOSITORY_OWNER: ${{ gitea.repository_owner }} RPM_PACKAGE_GROUP: ${{ env.RPM_PACKAGE_GROUP }} RPM_PACKAGE_TOKEN: ${{ secrets.RPM_PACKAGE_TOKEN }} RPM_PACKAGE_USERNAME: ${{ vars.RPM_PACKAGE_USERNAME }} RELEASE_ASSETS_DIR: ${{ env.RELEASE_ASSETS_DIR }} run: ./.gitea/scripts/upload-rpm-packages.sh - name: Create Gitea release uses: https://gitea.com/actions/gitea-release-action@v1 with: name: Kordophoned Core ${{ env.RELEASE_VERSION }} tag_name: ${{ github.ref_name }} target_commitish: ${{ github.sha }} files: | ${{ env.RELEASE_ASSETS_DIR }}/*.rpm