chore: release v3.0.23 #47
Workflow file for this run
This file contains hidden or 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
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Versão (ex: 3.0.47)' | |
| required: true | |
| type: string | |
| prerelease: | |
| description: 'Marcar como pre-release' | |
| required: false | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 9 | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| VERSION="${{ inputs.version }}" | |
| else | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build packages | |
| run: | | |
| echo "Building version ${{ env.VERSION }}" | |
| pnpm run build:prod | |
| - name: Pack packages | |
| run: pnpm run pack | |
| - name: Generate release notes | |
| id: release_notes | |
| run: | | |
| # Obter commits desde a última tag | |
| PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") | |
| echo "## O que mudou" > release_notes.md | |
| echo "" >> release_notes.md | |
| echo "### Commits desde $PREV_TAG" >> release_notes.md | |
| echo "" >> release_notes.md | |
| if [ -n "$PREV_TAG" ]; then | |
| git log ${PREV_TAG}..HEAD --pretty=format:"- %s (%h)" --reverse >> release_notes.md | |
| else | |
| git log --pretty=format:"- %s (%h)" --reverse -20 >> release_notes.md | |
| fi | |
| echo "" >> release_notes.md | |
| echo "### Packages" >> release_notes.md | |
| echo "" >> release_notes.md | |
| echo "- @archbase/core" >> release_notes.md | |
| echo "- @archbase/data" >> release_notes.md | |
| echo "- @archbase/components" >> release_notes.md | |
| echo "- @archbase/layout" >> release_notes.md | |
| echo "- @archbase/security" >> release_notes.md | |
| echo "- @archbase/security-ui" >> release_notes.md | |
| echo "- @archbase/feature-flags" >> release_notes.md | |
| echo "- @archbase/admin" >> release_notes.md | |
| echo "- @archbase/advanced" >> release_notes.md | |
| echo "- @archbase/template" >> release_notes.md | |
| echo "- @archbase/tools" >> release_notes.md | |
| echo "- @archbase/ssr" >> release_notes.md | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: packages-${{ env.VERSION }} | |
| path: | | |
| *.tgz | |
| packages/*/*.tgz | |
| retention-days: 90 | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ env.VERSION }} | |
| name: Release v${{ env.VERSION }} | |
| body_path: release_notes.md | |
| prerelease: ${{ github.event.inputs.prerelease == 'true' || contains(env.VERSION, 'beta') || contains(env.VERSION, 'alpha') }} | |
| files: | | |
| *.tgz | |
| packages/*/*.tgz | |
| draft: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to Registry (optional) | |
| if: ${{ !contains(env.VERSION, 'beta') && !contains(env.VERSION, 'alpha') && !inputs.prerelease }} | |
| run: | | |
| # Criar .npmrc limpo para CI | |
| cat > .npmrc << 'EOF' | |
| registry=https://registry.npmjs.org | |
| @archbase:registry=https://registry.npmjs.org/ | |
| node-linker=hoisted | |
| shamefully-hoist=true | |
| EOF | |
| # Configurar auth | |
| npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }} | |
| echo "Registry configurado: $(npm config get registry)" | |
| echo "@archbase registry: $(npm config get @archbase:registry)" | |
| pnpm run publish:prod | |
| release-docs: | |
| needs: release | |
| if: ${{ !contains(github.ref, 'beta') && !contains(github.ref, 'alpha') && github.event.inputs.prerelease != 'true' }} | |
| runs-on: self-hosted | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Build and deploy docs | |
| run: | | |
| pnpm install --frozen-lockfile | |
| cd docs-site | |
| export NODE_OPTIONS=--max_old_space_size=8192 | |
| pnpm run build | |
| sudo mkdir -p /srv/archbase-react-docs | |
| sudo rm -rf /srv/archbase-react-docs/* | |
| sudo cp -r out/* /srv/archbase-react-docs/ | |
| cd /opt/archbase-infrastructure || exit 0 | |
| docker stack deploy -c docker-compose.yml archbase-react | |
| - name: Docker system prune | |
| run: | | |
| # Remover imagens não usadas e cache de build para liberar espaço | |
| docker image prune -a -f --filter "until=72h" | |
| docker system prune -f | |
| df -h /var/lib/docker |