From 4539ef00132b44430b58037f69cd36c542664a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Tue, 2 Apr 2024 17:14:24 +0200 Subject: [PATCH 1/2] Add version checking workflow --- .github/workflows/git-tags.yml | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/git-tags.yml diff --git a/.github/workflows/git-tags.yml b/.github/workflows/git-tags.yml new file mode 100644 index 00000000..ccfcb210 --- /dev/null +++ b/.github/workflows/git-tags.yml @@ -0,0 +1,41 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow + +name: "Git tags" + +on: + push: + tags: + - "v*" + +permissions: + contents: "read" + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + +jobs: + missing_tag: + name: "Tag without version bump" + runs-on: "ubuntu-latest" + steps: + - + name: "Set up PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "8.2" + extensions: "dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, fileinfo, exif" + - + name: "Checkout repository" + uses: "actions/checkout@v4" + with: + fetch-depth: 0 + - + name: "Check latest tagged version" + run: | + LATEST_TAG="$(git describe --tags --abbrev=0)" + CURRENT_VERSION="v$(php -r 'require __DIR__.'/src/Root.php'; echo Cone\Root\Root::VERSION;')" + if [ "${LATEST_TAG}" != "${CURRENT_VERSION}" ]; then + echo "::error::Latest tag differs from current version" + exit 10 + fi From fd5664bf06915869c047d556aa7b7a4c68c2ed94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Tue, 2 Apr 2024 17:17:37 +0200 Subject: [PATCH 2/2] fix quotes --- .github/workflows/git-tags.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/git-tags.yml b/.github/workflows/git-tags.yml index ccfcb210..0036996b 100644 --- a/.github/workflows/git-tags.yml +++ b/.github/workflows/git-tags.yml @@ -34,7 +34,7 @@ jobs: name: "Check latest tagged version" run: | LATEST_TAG="$(git describe --tags --abbrev=0)" - CURRENT_VERSION="v$(php -r 'require __DIR__.'/src/Root.php'; echo Cone\Root\Root::VERSION;')" + CURRENT_VERSION="v$(php -r 'require __DIR__."/src/Root.php"; echo Cone\Root\Root::VERSION;')" if [ "${LATEST_TAG}" != "${CURRENT_VERSION}" ]; then echo "::error::Latest tag differs from current version" exit 10