Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
if: github.ref_type == 'tag' || github.event_name == 'workflow_dispatch'
run: |
TAG=$(git describe --tags --exact-match || echo "")
echo "IMAGE_TAG=$TAG" >> $GITHUB_ENV
echo "LATEST_TAG=$TAG" >> $GITHUB_ENV

- name: Create tags for publishing image
id: meta
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/semver-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Auto Tag with SemVer

on:
push:
branches:
- main
workflow_dispatch:
jobs:
tag-main:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Fetch all tags
run: git fetch --tags --force

- name: Get latest semver tag
id: get_latest_tag
run: |
# Get all tags and filter for valid semver tags (vX.Y.Z format)
LATEST_TAG=$(git tag -l '[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n 1)

# If no valid semver tags exist, start with 0.0.0
if [ -z "$LATEST_TAG" ]; then
echo "::error::No semantic versioning tags found in the repository. Please create an initial tag (e.g., 0.0.0) manually."
exit 1
fi

echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT

# Extract the version numbers
VERSION=${LATEST_TAG}
MAJOR=$(echo $VERSION | cut -d. -f1)
MINOR=$(echo $VERSION | cut -d. -f2)
PATCH=$(echo $VERSION | cut -d. -f3)

# Increment patch version
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"

echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT

- name: Create new tag
id: create_tag
run: |
NEW_TAG="${{ steps.get_latest_tag.outputs.new_version }}"
echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT

git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git tag -a $NEW_TAG -m "Auto-incremented patch version"

- name: Push tag
run: |
git push origin ${{ steps.create_tag.outputs.new_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

21 changes: 11 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "daedalus",
"private": true,
"version": "0.0.5",
"version": "0.0.7",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -15,7 +15,7 @@
"preview": "vite preview"
},
"dependencies": {
"@diamondlightsource/cs-web-lib": "^0.9.7",
"@diamondlightsource/cs-web-lib": "^0.9.8",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@mui/icons-material": "^5.15.17",
Expand Down
Loading