diff --git a/.github/workflows/increment-major.yml b/.github/workflows/increment-major.yml new file mode 100644 index 0000000..52297e9 --- /dev/null +++ b/.github/workflows/increment-major.yml @@ -0,0 +1,36 @@ +name: Increment Major Version + +on: + push: + branches: + - main + +jobs: + increment-major: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Read and increment version + run: | + VERSION_FILE=".version" + CURRENT_VERSION=$(cat $VERSION_FILE) + IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" + MAJOR=$((MAJOR + 1)) + MINOR=0 + PATCH=0 + NEW_VERSION="$MAJOR.$MINOR.$PATCH" + echo "$NEW_VERSION" > $VERSION_FILE + echo "Version updated to $NEW_VERSION" + + - name: Commit changes + run: | + git config --local user.email "spencerjack646@gmail.com" + git config --local user.name "CubeDood" + git add .version + git commit -m "Increment major version to $NEW_VERSION" + git push + env: + GITHUB_TOKEN: ${{ secrets.CUBEDOOD_TOKEN }} diff --git a/.github/workflows/increment-minor.yml b/.github/workflows/increment-minor.yml new file mode 100644 index 0000000..70cca7f --- /dev/null +++ b/.github/workflows/increment-minor.yml @@ -0,0 +1,35 @@ +name: Increment Minor Version + +on: + push: + branches: + - main + +jobs: + increment-minor: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Read and increment version + run: | + VERSION_FILE=".version" + CURRENT_VERSION=$(cat $VERSION_FILE) + IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" + MINOR=$((MINOR + 1)) + PATCH=0 + NEW_VERSION="$MAJOR.$MINOR.$PATCH" + echo "$NEW_VERSION" > $VERSION_FILE + echo "Version updated to $NEW_VERSION" + + - name: Commit changes + run: | + git config --local user.email "spencerjack646@gmail.com" + git config --local user.name "CubeDood" + git add .version + git commit -m "Increment minor version to $NEW_VERSION" + git push + env: + GITHUB_TOKEN: ${{ secrets.CUBEDOOD_TOKEN }} diff --git a/.github/workflows/increment-patch.yml b/.github/workflows/increment-patch.yml new file mode 100644 index 0000000..537f760 --- /dev/null +++ b/.github/workflows/increment-patch.yml @@ -0,0 +1,34 @@ +name: Increment Patch Version + +on: + push: + branches: + - main + +jobs: + increment-patch: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Read and increment version + run: | + VERSION_FILE=".version" + CURRENT_VERSION=$(cat $VERSION_FILE) + IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" + PATCH=$((PATCH + 1)) + NEW_VERSION="$MAJOR.$MINOR.$PATCH" + echo "$NEW_VERSION" > $VERSION_FILE + echo "Version updated to $NEW_VERSION" + + - name: Commit changes + run: | + git config --local user.email "spencerjack646@gmail.com" + git config --local user.name "CubeDood" + git add .version + git commit -m "Increment patch version to $NEW_VERSION" + git push + env: + GITHUB_TOKEN: ${{ secrets.CUBEDOOD_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 96038fe..e8cfdc1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: '16' # Use your desired Node.js version + node-version: '16' - name: Install dependencies run: npm install @@ -36,7 +36,7 @@ jobs: id: create_release uses: softprops/action-gh-release@v1 with: - tag_name: "${{ env.VERSION }}" # Use the version from the file as the tag name + tag_name: "${{ env.VERSION }}" files: "${{ env.VERSION }}.zip" env: GITHUB_TOKEN: ${{ secrets.CUBEDOOD_TOKEN }} diff --git a/.version b/.version index 570520f..bd52db8 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.0.111 \ No newline at end of file +0.0.0 \ No newline at end of file