Skip to content

Commit 4ea5ee6

Browse files
authored
Merge pull request #13 from bhcosta90/feature/add-workflow
refactor tag.yml for improved clarity and consistency in messages
2 parents 9a85874 + cbfca05 commit 4ea5ee6

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

.github/workflows/tag.yml

+25-25
Original file line numberDiff line numberDiff line change
@@ -15,60 +15,60 @@ jobs:
1515
auto-tag:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- name: Checkout código
18+
- name: Checkout code
1919
uses: actions/checkout@v4
2020
with:
2121
fetch-depth: 0
2222

23-
- name: Configurar Git
23+
- name: Set up Git
2424
run: |
2525
git config --global user.email "[email protected]"
2626
git config --global user.name "GitHub Actions"
2727
28-
- name: Criar a tag inicial caso nenhuma tag exista
28+
- name: Create initial tag if no tag exists
2929
id: first_tag
3030
run: |
3131
TAG=$(git tag --list --sort=-v:refname | grep -E '^(dev-)?[0-9]+\.[0-9]+\.[0-9]+$' | sed 's/^dev-//' | head -n 1)
3232
3333
if [[ -z "$TAG" ]]; then
3434
TAG="0.0.0"
35-
echo "Nenhuma tag encontrada. Criando tag inicial: $TAG"
35+
echo "No tag found. Creating initial tag: $TAG"
3636
git tag "$TAG"
3737
git push origin "$TAG"
38-
echo "Tag criada com sucesso: $TAG"
38+
echo "Tag created successfully: $TAG"
3939
fi
4040
41-
- name: Obter última tag válida
41+
- name: Get the last valid tag
4242
id: last_tag
4343
run: |
44-
# Obtém a última versão estável (X.Y.Z), ignorando as dev-*
44+
# Get the last stable version (X.Y.Z), ignoring dev-*
4545
LAST_STABLE_TAG=$(git tag --list --sort=-v:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
4646
47-
# Obtém a última versão de feature (dev-X.Y.Z-N)
47+
# Get the last feature version (dev-X.Y.Z-N)
4848
LAST_FEATURE_TAG=$(git tag --list --sort=-v:refname "dev-*" | head -n 1 | sed 's/dev-//')
4949
50-
# Define a base da nova versão
50+
# Set the base for the new version
5151
if [[ -z "$LAST_STABLE_TAG" ]]; then
5252
LAST_STABLE_TAG="0.0.0"
5353
fi
5454
55-
echo "Última versão estável: $LAST_STABLE_TAG"
56-
echo "Última versão de feature: $LAST_FEATURE_TAG"
55+
echo "Last stable version: $LAST_STABLE_TAG"
56+
echo "Last feature version: $LAST_FEATURE_TAG"
5757
echo "tag=$LAST_STABLE_TAG" >> $GITHUB_ENV
5858
echo "feature_tag=$LAST_FEATURE_TAG" >> $GITHUB_ENV
5959
60-
- name: Determinar novo número de versão
60+
- name: Determine new version number
6161
id: new_tag
6262
run: |
6363
STABLE_TAG="${{ env.tag }}"
6464
FEATURE_TAG="${{ env.feature_tag }}"
6565
6666
BASE_TAG="$STABLE_TAG"
6767
68-
# Corrigir a atribuição de BRANCH no evento push
68+
# Fix the assignment of BRANCH for the push event
6969
if [[ "${{ github.event_name }}" == "push" ]]; then
70-
BRANCH="${{ github.ref }}" # Ref completa: refs/heads/develop
71-
BRANCH="${BRANCH/refs\/heads\//}" # Remove o prefixo 'refs/heads/'
70+
BRANCH="${{ github.ref }}" # Full ref: refs/heads/develop
71+
BRANCH="${BRANCH/refs\/heads\//}" # Remove the 'refs/heads/' prefix
7272
else
7373
BRANCH="${GITHUB_HEAD_REF}"
7474
fi
@@ -79,11 +79,11 @@ jobs:
7979
if [[ "$BRANCH" == feature/* || "$BRANCH" == develop ]]; then
8080
PREFIX="dev-"
8181
82-
# Se a última feature já estava baseada na última versão estável, continua o incremento
82+
# If the last feature was based on the last stable version, continue the increment
8383
if [[ "$FEATURE_TAG" == "$STABLE_TAG"-* ]]; then
8484
LAST_SUFFIX=$(echo "$FEATURE_TAG" | grep -oE '[0-9]+$' || echo "-1")
8585
else
86-
# Caso contrário, iniciamos a contagem a partir da nova versão estável
86+
# Otherwise, start counting from the new stable version
8787
LAST_SUFFIX="-1"
8888
fi
8989
@@ -102,7 +102,7 @@ jobs:
102102
NEW_SUFFIX=""
103103
BASE_TAG="${VERSION[0]}.${VERSION[1]}.${VERSION[2]}"
104104
else
105-
echo "Branch não suportada para tagging automática."
105+
echo "Unsupported branch for automatic tagging."
106106
exit 1
107107
fi
108108
@@ -112,22 +112,22 @@ jobs:
112112
NEW_TAG="${PREFIX}${BASE_TAG}"
113113
fi
114114
115-
echo "Nova tag: $NEW_TAG"
115+
echo "New tag: $NEW_TAG"
116116
echo "new_tag=$NEW_TAG" >> $GITHUB_ENV
117117
118-
- name: Criar e enviar nova tag
118+
- name: Create and push new tag
119119
run: |
120-
# Verifica se o PR foi mesclado, ou se é um push direto na develop
120+
# Check if the PR was merged or if it's a direct push to develop
121121
if [[ "${{ github.event.pull_request.merged }}" != "true" && "${{ github.event_name }}" != "push" ]]; then
122-
echo "O PR não foi mesclado ou o evento não é um push. Finalizando o fluxo."
122+
echo "The PR was not merged or the event is not a push. Ending the workflow."
123123
exit 0
124124
fi
125125
126-
# Verifica se o push é na branch develop
126+
# Check if the push is on the develop branch
127127
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" != "refs/heads/develop" ]]; then
128-
echo "Push não realizado na branch 'develop'. Finalizando o fluxo."
128+
echo "Push not made on the 'develop' branch. Ending the workflow."
129129
exit 0
130130
fi
131131
132132
git tag "${{ env.new_tag }}"
133-
git push origin "${{ env.new_tag }}"
133+
git push origin "${{ env.new_tag }}"

0 commit comments

Comments
 (0)