This reusable GitHub Actions workflow automates the process of creating new version tags for your repository. It handles version bumping, tag creation, and optional email notifications for successful or failed runs.
The workflow performs the following tasks:
- Sets up the Node.js environment
- Configures Git and GitHub credentials
- Processes version type inputs
- Updates package version
- Creates and pushes tags
- Sends email notifications (optional)
To use this workflow in your repository, create a new workflow file (e.g., .github/workflows/create-tag.yml) and call this reusable workflow:
name: Create New Tag
on:
workflow_dispatch:
inputs:
version_type:
description: 'Version type (patch/minor/major)'
required: false
default: 'patch'
jobs:
create-tag:
uses: wrappid/workflows/.github/workflows/create-tag.yml@main
with:
GIT_USER_NAME: "Your Name"
VERSION_TYPE_REPOSITORY_DEFAULT: "-r patch"
EMAIL_NOTIFY: "true"
EMAIL_SENDER_NAME: "CI/CD Pipeline"
secrets:
PAT: ${{ secrets.PAT }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
WRAPPID_REGISTRY_TOKEN: ${{ secrets.WRAPPID_REGISTRY_TOKEN }}
EMAIL_SERVER_ADDRESS: ${{ secrets.EMAIL_SERVER_ADDRESS }}
EMAIL_SERVER_PORT: ${{ secrets.EMAIL_SERVER_PORT }}
EMAIL_USER_ID: ${{ secrets.EMAIL_USER_ID }}
EMAIL_USER_PASSWORD: ${{ secrets.EMAIL_USER_PASSWORD }}
EMAIL_TO: ${{ secrets.EMAIL_TO }}
EMAIL_CC: ${{ secrets.EMAIL_CC }}
EMAIL_BCC: ${{ secrets.EMAIL_BCC }}| Name | Required | Default | Description |
|---|---|---|---|
GIT_USER_NAME |
Yes | - | The name to use for Git commits |
VERSION_TYPE_REPOSITORY_DEFAULT |
No | - | Default version increment type ("-r patch", "-r minor", "-r major") |
EMAIL_NOTIFY |
Yes | "true" | Enable/disable email notifications |
EMAIL_SENDER_NAME |
No | - | Name to use as email sender |
PAT: GitHub Personal Access TokenGIT_USER_EMAIL: Email to use for Git commitsWRAPPID_REGISTRY_TOKEN: Token for accessing Wrappid npm registry
EMAIL_SERVER_ADDRESS: SMTP server addressEMAIL_SERVER_PORT: SMTP server portEMAIL_USER_ID: SMTP user IDEMAIL_USER_PASSWORD: SMTP user passwordEMAIL_TO: Recipient email address(es)
EMAIL_CC: CC email address(es)EMAIL_BCC: BCC email address(es)
| Name | Description |
|---|---|
tag-version |
The version number of the created tag |
- If no version type is specified, defaults to patch version increment
- Supports major, minor, and patch version increments
- Custom repository defaults can be set via
VERSION_TYPE_REPOSITORY_DEFAULT
Special handling for specific repositories:
- wrappid/wrappid-app
- wrappid/wrappid-service
- wrappid/wrappid-module
The workflow can send emails for:
- Successful tag creation
- Workflow failures
- Node.js project with a package.json file
- GitHub repository with proper permissions
- Required secrets configured in repository settings
- SMTP server access (if email notifications enabled)
- The workflow runs on Ubuntu latest
- Requires write-all permissions
- Uses Node.js version 18
- Automatically pushes tags to the development branch
- Email notifications are optional but require additional configuration if enabled
TODO items marked in the workflow:
- Add attribution trigger
- Check for attribution changes
- Implement attribution commit logic if changes found