Skip to content

Commit

Permalink
Pequenos ajustes no pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianosan committed Oct 24, 2024
1 parent 84d50ac commit 7737d2b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,23 @@ jobs:
# Identifica a última tag
- name: Get the latest tag
id: last_tag
run: echo "tag=$(git describe --tags $(git rev-list --tags --max-count=1) || echo 'lambda_functions_v0.0')" >> $GITHUB_ENV
run: echo "tag=$(git describe --tags $(git rev-list --tags --max-count=1) || echo 'lambda_functions_v0.1')" >> $GITHUB_ENV

# Define a versão para o release
- name: Set release version
id: get_version
run: |
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1) || echo 'lambda_functions_v0.0')
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1) || echo 'lambda_functions_v0.1')
version=$(echo $latest_tag | sed 's/lambda_functions_v//')
IFS='.' read -r major minor patch <<< "$version"
minor=$((minor + 1))
new_version="lambda_functions_v${major}.${minor}"
echo "New version is $new_version"
echo "version=$new_version" >> $GITHUB_ENV
# Cria um arquivo ZIP da pasta lambda_functions
# Cria um arquivo ZIP da pasta lambda_functions (se houver mudanças)
- name: Zip lambda_functions folder
if: ${{ env.has_changes == 'true' }} # Gera o ZIP somente se houver mudanças
if: ${{ env.has_changes == 'true' }}
run: zip -r lambda_functions_${{ env.version }}.zip lambda_functions

# Verifica se a tag já existe
Expand All @@ -76,7 +76,7 @@ jobs:
echo "exists=false" >> $GITHUB_ENV
fi
# Cria o release no GitHub
# Cria o release no GitHub (se não existir uma com mesmo nome)
- name: Create Release
id: create_release
if: env.exists == 'false'
Expand All @@ -85,22 +85,22 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.version }}
release_name: Release ${{ env.version }}
release_name: ${{ env.version }}
body_path: ./release_notes.md
draft: false
prerelease: false

# Sobe o pacote de artefatos no release
# Sobe o pacote de artefatos no release (se houver mudanças)
- name: Upload Release Asset
if: ${{ env.has_changes == 'true' }} # Condicional para evitar upload se não houver mudanças
if: ${{ env.has_changes == 'true' }}
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: lambda_functions_${{ env.version }}.zip
asset_name: lambda_functions_${{ env.version }}.zip
asset_content_type: application/zip

# Remove o arquivo .zip local após o release
# Remove o arquivo .zip local após o release (se for criado)
- name: Clean up
if: ${{ env.has_changes == 'true' }} # Limpa somente se houver mudanças
run: rm lambda_functions_${{ env.version }}.zip
if: ${{ env.has_changes == 'true' }}
run: rm lambda_functions_${{ env.version }}.zip

0 comments on commit 7737d2b

Please sign in to comment.