feat: forgejo action #1

Merged
leandro merged 20 commits from development into master 2025-05-26 04:58:21 +00:00
Showing only changes of commit f34d573565 - Show all commits

View file

@ -46,16 +46,35 @@ jobs:
name: lhmask
path: lhmask
check-version:
runs-on: ubuntu-latest
outputs:
version_changed: ${{ steps.check.outputs.version_changed }}
steps:
- 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
run: |
OLD_VERSION=$(git show HEAD^:package.json | jq -r '.version')
NEW_VERSION=$(jq -r '.version' package.json)
echo "Versão anterior: $OLD_VERSION"
echo "Versão atual: $NEW_VERSION"
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
echo "version_changed=true" >> "$GITHUB_OUTPUT"
else
echo "version_changed=false" >> "$GITHUB_OUTPUT"
fi
publish-staging:
runs-on: docker
needs: prepare-package
container:
image: node:20-alpine
if: github.ref == 'refs/heads/development' || startsWith(github.ref, 'refs/heads/release-no-verify/')
if: needs.check-version.outputs.version_changed == 'true' && (github.ref == 'refs/heads/development' || startsWith(github.ref, 'refs/heads/release-no-verify/'))
steps:
- name: Git Clone
uses: actions/checkout@v4
- name: Download lhmask
uses: actions/download-artifact@v3
with:
@ -74,20 +93,18 @@ jobs:
needs: prepare-package
container:
image: node:20-alpine
if: github.ref == 'refs/heads/master'
if: needs.check-version.outputs.version_changed == 'true' && github.ref == 'refs/heads/master'
steps:
- name: Git Clone
uses: actions/checkout@v4
- name: Download lhmask
uses: actions/download-artifact@v3
with:
path: lhmask
name: lhmask
- name: Prepare Production Package
- name: Publish to NPM (staging)
run: |
cp package.json dist/
cp README.md dist/
cd lhmask
sed -i "s/-dev//g" dist/package.json
- name: Publish to NPM (production)
run: |
cd dist
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
npm publish
env:
@ -97,6 +114,6 @@ jobs:
runs-on: docker
needs: prepare-package
steps:
- name: Publish to NPM (production)
- name: finish
run: |
echo "OK Done".