ref: 9f05d8db707b2d117acf0a6f1f9796d9c1fa0b47
parent: cc4321d176fc13628687d6b7e7184282a0066a19
author: Jonne Kokkonen <jonne.kokkonen@gmail.com>
date: Sun Feb 23 15:19:21 EST 2025
add automatic rpm spec version bump
--- a/.github/workflows/nix-package.yml
+++ /dev/null
@@ -1,56 +1,0 @@
-name: Update Version and Hash in flake.nix
-
-on:
- push:
- tags:
- - v1.*
- workflow_dispatch:
-
-jobs:
- update-version:
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- ref: ${{ github.event.push.head.ref }}-
- - name: Set up Nix
- uses: cachix/install-nix-action@v22
- with:
- nix_path: nixpkgs=channel:nixos-unstable
-
- - name: Find newest annotated tag
- id: newest-tag
- run: |
- latest_annotated_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
- echo "Newest annotated tag: $latest_annotated_tag"
- echo "latest_annotated_tag=$latest_annotated_tag" >> $GITHUB_OUTPUT
-
- - name: Check if tag is valid version
- id: valid-tag
- run: |
- latest_annotated_tag="${{ steps.newest-tag.outputs.latest_annotated_tag }}"- echo "Passed value: $latest_annotated_tag"
- if [[ $latest_annotated_tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
- echo "Valid tag format"
- echo "valid=true" >> $GITHUB_OUTPUT
- else
- echo "Invalid tag format"
- echo "valid=false" >> $GITHUB_OUTPUT
- fi
-
- - name: Update version in flake.nix
- if: steps.valid-tag.outputs.valid
- run: |
- latest_annotated_tag="${{ steps.newest-tag.outputs.latest_annotated_tag }}"- latest_annotated_tag_without_v="${latest_annotated_tag#v}" # Remove 'v' prefix- sed -i "s/version = \".*\";/version = \"$latest_annotated_tag_without_v\";/" flake.nix
- new_hash=$(nix-prefetch-url --unpack --type sha256 "https://github.com/laamaa/m8c/archive/v$latest_annotated_tag_without_v.tar.gz") # Use updated variable name
- sed -i "s/hash = \".*\";/hash = \"sha256:$new_hash\";/" flake.nix
- git config user.email "github-actions@github.com"
- git config user.name "GitHub Actions"
- git commit -am "Update version and hash in flake.nix to $latest_annotated_tag_without_v"
- git push origin HEAD:main
--- /dev/null
+++ b/.github/workflows/update-package-versions.yml
@@ -1,0 +1,57 @@
+name: Update Version and Hash in flake.nix/RPM spec
+
+on:
+ push:
+ tags:
+ - v1.*
+ workflow_dispatch:
+
+jobs:
+ update-version:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ ref: ${{ github.event.push.head.ref }}+
+ - name: Set up Nix
+ uses: cachix/install-nix-action@v22
+ with:
+ nix_path: nixpkgs=channel:nixos-unstable
+
+ - name: Find newest annotated tag
+ id: newest-tag
+ run: |
+ latest_annotated_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
+ echo "Newest annotated tag: $latest_annotated_tag"
+ echo "latest_annotated_tag=$latest_annotated_tag" >> $GITHUB_OUTPUT
+
+ - name: Check if tag is valid version
+ id: valid-tag
+ run: |
+ latest_annotated_tag="${{ steps.newest-tag.outputs.latest_annotated_tag }}"+ echo "Passed value: $latest_annotated_tag"
+ if [[ $latest_annotated_tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
+ echo "Valid tag format"
+ echo "valid=true" >> $GITHUB_OUTPUT
+ else
+ echo "Invalid tag format"
+ echo "valid=false" >> $GITHUB_OUTPUT
+ fi
+
+ - name: Update version in flake.nix and RPM spec
+ if: steps.valid-tag.outputs.valid
+ run: |
+ latest_annotated_tag="${{ steps.newest-tag.outputs.latest_annotated_tag }}"+ latest_annotated_tag_without_v="${latest_annotated_tag#v}" # Remove 'v' prefix+ sed -i "s/version = \".*\";/version = \"$latest_annotated_tag_without_v\";/" flake.nix
+ sed -i "s/Version:.*/Version: $latest_annotated_tag_without_v/" package/rpm/m8c.spec
+ new_hash=$(nix-prefetch-url --unpack --type sha256 "https://github.com/laamaa/m8c/archive/v$latest_annotated_tag_without_v.tar.gz") # Use updated variable name
+ sed -i "s/hash = \".*\";/hash = \"sha256:$new_hash\";/" flake.nix
+ git config user.email "github-actions@github.com"
+ git config user.name "GitHub Actions"
+ git commit -am "Update version and hash in flake.nix, update RPM spec version to $latest_annotated_tag_without_v"
+ git push origin HEAD:main
--- a/package/rpm/m8c.spec
+++ b/package/rpm/m8c.spec
@@ -1,5 +1,5 @@
Name: m8c
-Version: 1.7.8
+Version: 1.2.3
Release: 1%{?dist}Summary: m8c is a client for Dirtywave M8 music tracker's headless mode
--
⑨