diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 594ec88..a3ebe60 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: Test, Build and Release +name: Tool Release on: push: diff --git a/.github/workflows/test-build.yaml b/.github/workflows/test-build.yaml index ec9d25d..4b87571 100644 --- a/.github/workflows/test-build.yaml +++ b/.github/workflows/test-build.yaml @@ -1,4 +1,4 @@ -name: Test +name: Test and build on: workflow_call: @@ -31,6 +31,8 @@ jobs: needs: test name: build-${{matrix.name}} runs-on: ${{matrix.runs-on}} + permissions: + contents: write strategy: fail-fast: false matrix: @@ -61,6 +63,16 @@ jobs: cache: true experimental: true - run: bun install + - name: Bump version + if: startsWith(github.ref, 'refs/tags/') + run: | + version=$(echo ${{ github.ref }} | sed -e s%refs/tags/%%) + echo "New tag found. Updating package.json to $version..." + jq --indent 4 '.version = $version' package.json > package.json.tmp + mv package.json.tmp package.json + bun biome format --write package.json + git add package.json + git commit -m "[skip ci]: Bump version $version" - name: Create binary and release files run: | jq -r '.version' package.json diff --git a/.husky/pre-push b/.husky/pre-push index 92c2c11..707ae3e 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,26 +1,3 @@ #!/usr/bin/env sh -# shellcheck disable=SC2034 -while read lref new rref old -do - case $rref in - refs/tags/*) - if echo "$rref"; then - version=$(echo "$rref" | sed s/.*v//) - tmp_pkg=$(mktemp) - echo "New tag found. Updating package.json to $version..." - echo "Current version: $(jq -r .version ./package.json)" - jq --indent 4 --arg version "$version" '.version = $version' ./package.json > "$tmp_pkg" && mv "$tmp_pkg" ./package.json - bun biome format --write package.json - git add package.json - git commit -m "[skip-ci]: Bump version $version" - exit 0 - else - bun branch-name-lint package.json - fi;; - *) - ;; - esac -done - - +bun branch-name-lint package.json diff --git a/commitlint.config.cjs b/commitlint.config.cjs index 0eedc2e..1046e6a 100644 --- a/commitlint.config.cjs +++ b/commitlint.config.cjs @@ -1,6 +1,6 @@ module.exports = { extends: ["@commitlint/config-conventional"], - ignores: [(commit) => commit.startsWith("[skip-ci]")], + ignores: [(commit) => commit.startsWith("[skip ci]")], rules: { "body-max-line-length": [0, "always", 200], }, diff --git a/package.json b/package.json index 554a735..7fcce26 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,6 @@ "releases": "release" }, "banned": ["wip"], - "skip": ["skip-ci"] + "skip": ["skip ci", "main", "develop"] } }