From 3d6efa448b6642792e086b3d76a07b421d4f27b2 Mon Sep 17 00:00:00 2001 From: javalsai Date: Fri, 4 Jul 2025 18:59:04 +0200 Subject: [PATCH] ci: update make release action --- .github/workflows/make-release.yml | 42 +++++++++++++++++++++++------- Makefile | 8 ++++-- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml index d036719..c44c01a 100644 --- a/.github/workflows/make-release.yml +++ b/.github/workflows/make-release.yml @@ -2,23 +2,45 @@ name: Check and Build Release on: workflow_dispatch: - inputs: - version: - required: true - default: '' - type: string jobs: + release-checks: + name: Release Checks + runs-on: ubuntu-24.04 + permissions: write-all + outputs: + VERSION: ${{ steps.check-ver-changed.outputs.VERSION }} + steps: + - uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: "git" + version: 1.0 + - uses: actions/checkout@v4 + + - name: Check Version Changed + id: check-ver-changed + run: | + GIT_TAG=$(git describe --no-long --abbrev=0 --tags --always) + MAKE_TAG=$(make print-version) + + if [[ "$GIT_TAG" == "v$MAKE_TAG" ]]; then + echo "ERR: Git tag matches makefile, did you bump Makefile up?" >&2 + exit 1 + fi + echo "VERSION=$MAKE_TAG" >> "$GITHUB_OUTPUT" + + build: name: Check and Build + needs: release-checks uses: ./.github/workflows/check-and-build.yml permissions: write-all release: - name: Make Release v${{ inputs.version }} + name: Make Release v${{ needs.release-checks.outputs.VERSION }} runs-on: ubuntu-24.04 permissions: write-all - needs: build + needs: [ release-checks, build ] steps: - uses: actions/download-artifact@v4 with: @@ -28,7 +50,7 @@ jobs: - uses: ncipollo/release-action@v1 with: - tag: v${{ inputs.version }} + tag: v${{ needs.release-checks.outputs.VERSION }} commit: ${{ github.sha }} artifacts: builds/lidm-* artifactErrorsFailBuild: true @@ -39,7 +61,7 @@ jobs: runs-on: ubuntu-24.04 container: archlinux:latest permissions: write-all - needs: release + needs: [ release-checks, release ] steps: - run: pacman -Sy --noconfirm git github-cli base-devel pacman-contrib @@ -51,7 +73,7 @@ jobs: cd "assets/pkg/aur" chown nobody:nobody . -R - su - -s /bin/bash nobody -c "$PWD/update-pkgs.sh ${{ inputs.version }}" + su - -s /bin/bash nobody -c "$PWD/update-pkgs.sh ${{ needs.release-checks.outputs.VERSION }}" su - -s /bin/bash nobody -c "$PWD/test-makepkg.sh" # This will also update -git pkgver chown $UID:$(id -g) . -R diff --git a/Makefile b/Makefile index f2f1a5a..ff9ef8b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = 1.1.1 +VERSION = 1.2.0 .DEFAULT_GOAL := lidm CDIR=src @@ -91,6 +91,9 @@ pre-commit: clang-format -i $$(git ls-files "*.c" "*.h") clang-tidy -p . $$(git ls-files "*.c" "*.h") +print-version: + @echo $(VERSION) + .PHONY: clean \ install uninstall \ install-service \ @@ -99,4 +102,5 @@ pre-commit: install-service-runit \ install-service-openrc \ install-service-systemd \ - pre-commit + pre-commit \ + print-version