feat: check-package-version
This commit is contained in:
parent
eccda535da
commit
403aeac049
1 changed files with 37 additions and 0 deletions
37
.forgejo/actions/check-package-version/action.yaml
Normal file
37
.forgejo/actions/check-package-version/action.yaml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
name: Verify package.json version
|
||||||
|
description: This action will provide $PACKAGE_VERSION env variable, and
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
package_json_path:
|
||||||
|
description: Path to package.json file
|
||||||
|
default: package.json
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Instalando Dependencias
|
||||||
|
shell: sh
|
||||||
|
run: apk add git jq
|
||||||
|
|
||||||
|
- name: Checkout do repositório
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 2 # Necessário para acessar o commit anterior
|
||||||
|
|
||||||
|
- name: Verificar mudança de versão no package.json
|
||||||
|
id: check-package-version
|
||||||
|
shell: sh
|
||||||
|
run: |
|
||||||
|
OLD_VERSION=$(git show HEAD^:${{ inputs.package_json_path }} | jq -r '.version')
|
||||||
|
NEW_VERSION=$(jq -r '.version' ${{ inputs.package_json_path }})
|
||||||
|
|
||||||
|
echo "Versão anterior: $OLD_VERSION"
|
||||||
|
echo "Versão atual: $NEW_VERSION"
|
||||||
|
|
||||||
|
echo "PACKAGE_VERSION=$NEW_VERSION" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
|
||||||
|
echo "version_changed=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "version_changed=false" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue