-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
5 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,24 +11,22 @@ on: | |
workflow_run: | ||
workflows: ["E2E Tests", "Unit Tests"] | ||
types: [completed] | ||
|
||
env: | ||
TAG_NAME: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name || github.ref_name }} | ||
|
||
jobs: | ||
validate-tag: | ||
name: Validate tag | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} | ||
steps: | ||
- name: Validate Tag Format | ||
- name: Validate tag Format | ||
run: | | ||
if [[ ! "${{ env.TAG_NAME }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
echo "Error: Invalid tag format. Please use semver format (x.x.x)." | ||
exit 1 | ||
fi | ||
check-tag: | ||
name: Check Tag | ||
name: Check tag | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} | ||
steps: | ||
|
@@ -40,10 +38,9 @@ jobs: | |
run: | | ||
git fetch --tags | ||
if git rev-parse "${{ env.TAG_NAME }}" >/dev/null 2>&1; then | ||
echo "Tag already exists. Cancelling the release." | ||
echo "tag already exists. Cancelling the release." | ||
exit 1 | ||
fi | ||
check-version: | ||
name: Check Version | ||
runs-on: ubuntu-latest | ||
|
@@ -64,7 +61,6 @@ jobs: | |
exit 1 | ||
fi | ||
shell: bash | ||
|
||
update-version: | ||
runs-on: ubuntu-latest | ||
needs: check-version | ||
|
@@ -83,7 +79,6 @@ jobs: | |
git config user.email "[email protected]" | ||
git commit -am "chore: Update package.json version to ${{ env.TAG_NAME }}" | ||
git push origin HEAD | ||
create-release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
|
@@ -92,19 +87,17 @@ jobs: | |
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create Tag (only for workflow_dispatch) | ||
- name: Create tag (only for workflow_dispatch) | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
run: | | ||
git config user.name "github-actions" | ||
git config user.email "[email protected]" | ||
git tag ${{ env.TAG_NAME }} | ||
git push origin ${{ env.TAG_NAME }} | ||
- name: Set up GitHub CLI | ||
run: | | ||
sudo apt-get install -y gh | ||
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | ||
- name: Create Release with GitHub CLI | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|