Skip to content

Commit c56e1e1

Browse files
committed
ci: add auto tagging
1 parent 0339c5b commit c56e1e1

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

.devcontainer/dev.docker-compose.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
- .env
99
build:
1010
context: .
11-
dockerfile: .devcontainer/dev.Dockerfile
11+
dockerfile: configs/docker/dev.Dockerfile
1212
args:
1313
USERNAME: devu
1414
USER_UID: 1001
@@ -17,7 +17,9 @@ services:
1717
BIN_DEPLOY_PREP: ${BIN_DEPLOY_PREP}
1818
BIN_DEPLOY_REQ: ${BIN_DEPLOY_REQ}
1919
BUN_BIN: ${BUN_BIN_R}
20+
SSH_AUTH_SOCK: /ssh-agent
2021
volumes:
22+
- ${SSH_AUTH_SOCK:-/dev/null}:/ssh-agent
2123
- .:/workspace
2224
- ~/.config/git/config:/etc/gitconfig
2325
networks:

.github/workflows/new_tag.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Tag on version bump after rebase
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
tag:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Get version from package.json
21+
id: get_version
22+
run: |
23+
VERSION=$(grep '"version"' package.json | head -1 | sed -E 's/.*"version": *"([^"]+)".*/\1/')
24+
echo "Detected version: $VERSION"
25+
echo "version=$VERSION" >> $GITHUB_OUTPUT
26+
27+
- name: Check if tag exists
28+
id: tag_exists
29+
run: |
30+
TAG="v${{ steps.get_version.outputs.version }}"
31+
echo "Checking for tag: $TAG"
32+
if git rev-parse "$TAG" >/dev/null 2>&1; then
33+
echo "Tag already exists: $TAG"
34+
echo "exists=true" >> $GITHUB_OUTPUT
35+
else
36+
echo "Tag does not exist: $TAG"
37+
echo "exists=false" >> $GITHUB_OUTPUT
38+
fi
39+
40+
- name: Create and push tag
41+
if: steps.tag_exists.outputs.exists == 'false'
42+
run: |
43+
TAG="v${{ steps.get_version.outputs.version }}"
44+
git config user.name "github-actions[bot]"
45+
46+
echo "Creating tag: $TAG"
47+
git tag "$TAG"
48+
git push origin "$TAG"

0 commit comments

Comments
 (0)