Skip to content

Commit

Permalink
build(general): moved version bumping script before build
Browse files Browse the repository at this point in the history
  • Loading branch information
andreszorro committed Mar 11, 2024
1 parent 2510b5a commit f9b9c6e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 31 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ on:
jobs:
test:
uses: ./.github/workflows/test.yaml
build:
bumpVersion:
needs: test
runs-on: ubuntu-latest
steps:
- name: Bump version
run: scripts/bump-version.sh
if: startsWith(github.ref, 'refs/tags/')
build:
needs: bumpVersion
name: build-${{matrix.name}}
runs-on: ${{matrix.runs-on}}
strategy:
Expand Down Expand Up @@ -89,7 +96,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
path: ./dist
- name: Bump version and update install.sh file
- name: Update install.sh file
run: scripts/release.sh
if: startsWith(github.ref, 'refs/tags/')
- name: Create Release Draft
Expand Down
31 changes: 6 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"test:ci": "bun test --coverage",
"postinstall": "scripts/install-git-hooks.sh"
},
"trustedDependencies": [
"."
],
"trustedDependencies": ["."],
"type": "module",
"dependencies": {
"chalk": "^5.3.0",
Expand Down Expand Up @@ -44,35 +42,18 @@
"signal-exit": "3.x"
},
"lint-staged": {
"*.{json,ts,js,mjs,mts}": [
"bun biome ci"
],
"*.{ts,mjs}": [
"bun test:ci"
]
"*.{json,ts,js,mjs,mts}": ["bun biome ci"],
"*.{ts,mjs}": ["bun test:ci"]
},
"branchNameLinter": {
"prefixes": [
"feature",
"bugfix",
"hotfix",
"release"
],
"prefixes": ["feature", "bugfix", "hotfix", "release"],
"suggestions": {
"features": "feature",
"feat": "feature",
"fix": "bugfix",
"releases": "release"
},
"banned": [
"wip"
],
"skip": [
"skip-ci"
],
"disallowed": [
"main",
"develop"
]
"banned": ["wip"],
"skip": ["skip-ci"]
}
}
8 changes: 8 additions & 0 deletions scripts/bump-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euxo pipefail

SCFZ_VERSION="$(git describe --tags)"

# Update package.json with new version
tmp_pkg=$(mktemp)
jq --indent 4 --arg version "${SCFZ_VERSION/v/}" '.version = $version' ./package.json > "$tmp_pkg" && mv "$tmp_pkg" ./package.json
4 changes: 0 additions & 4 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,3 @@ done
# Renders and updates install script to reflect latest version
./scripts/render-install.sh >"$RELEASE_DIR"/install.sh
chmod +x "$RELEASE_DIR"/install.sh

# Update package.json with new version
tmp_pkg=$(mktemp)
jq --indent 4 --arg version "${SCFZ_VERSION/v/}" '.version = $version' ./package.json > "$tmp_pkg" && mv "$tmp_pkg" ./package.json

0 comments on commit f9b9c6e

Please sign in to comment.