feat: add chatroom message send #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Tests and Generate Tag | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
run-tests-and-tag: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the code | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Step 2: Set up Go environment | |
- name: Set Up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.23' | |
# Step 3: Install dependencies (if using modules) | |
- name: Install Dependencies | |
run: | | |
go mod tidy | |
go mod download | |
# Step 4: Run unit tests | |
- name: Run Unit Tests | |
run: go test ./... | |
# Step 5: Generate Tag | |
- name: Generate Tag | |
id: generate_tag | |
run: | | |
# Fetch existing tags | |
git fetch --tags | |
# Get the latest tag, default to 0.0.0 if none exists | |
latest_tag=$(git tag --sort=-v:refname | head -n 1) | |
if [ -z "$latest_tag" ]; then | |
latest_tag="0.0.0" | |
fi | |
# Split the version into major, minor, patch components | |
IFS='.' read -r major minor patch <<< "$latest_tag" | |
# Increment the patch version | |
patch=$((patch + 1)) | |
# Generate the new tag | |
new_tag="$major.$minor.$patch" | |
echo "New tag: $new_tag" | |
echo "tag=$new_tag" >> $GITHUB_ENV | |
# Step 6: Push the Tag | |
- name: Push Tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} | |
run: | | |
git tag ${{ env.tag }} | |
git push origin ${{ env.tag }} |