diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ebfce7f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,126 @@ +name: Release + +on: + push: + branches: [ main, release ] + workflow_dispatch: + +concurrency: + group: release-${{ github.ref }} + cancel-in-progress: false + +jobs: + test: + name: Test (Node ${{ matrix.node }} - Camunda ${{ matrix.camunda }}) + runs-on: ubuntu-latest + permissions: + contents: read + strategy: + fail-fast: true + matrix: + node: [22, 24] + camunda: ['8.8', '8.9'] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js ${{ matrix.node }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run unit tests + run: npm run test:unit + + - name: Start Camunda ${{ matrix.camunda }} with Docker Compose + run: | + cd assets/c8/${{ matrix.camunda }} + DATABASE=elasticsearch docker compose --profile elasticsearch up -d + env: + DATABASE: elasticsearch + + - name: Wait for Camunda to be ready + run: | + echo "Waiting for Camunda at localhost:8080..." + # First wait for topology endpoint + for i in {1..60}; do + if curl -s -f -u demo:demo http://localhost:8080/v2/topology > /dev/null; then + echo "Topology endpoint is ready!" + break + fi + echo "Attempt $i: Topology not ready yet, waiting..." + sleep 5 + done + + # Then wait an additional 30 seconds for broker to fully initialize + echo "Waiting additional time for broker to initialize..." + sleep 30 + + # Verify we can actually deploy + echo "Testing deployment capability..." + for i in {1..30}; do + if curl -s -u demo:demo http://localhost:8080/v2/topology | grep -q '"health":"healthy"'; then + echo "Broker is healthy, ready for deployments!" + exit 0 + fi + echo "Attempt $i: Broker not fully ready, waiting..." + sleep 2 + done + + echo "Camunda may not be fully ready, but continuing with tests..." + + - name: Run integration tests + run: npm run test:integration + + - name: Stop Camunda + if: always() + run: | + cd assets/c8/${{ matrix.camunda }} + DATABASE=elasticsearch docker compose --profile elasticsearch down -v + env: + DATABASE: elasticsearch + + - name: Show Camunda logs on failure + if: failure() + run: | + cd assets/c8/${{ matrix.camunda }} + DATABASE=elasticsearch docker compose --profile elasticsearch logs + env: + DATABASE: elasticsearch + + release: + name: Release + runs-on: ubuntu-latest + needs: test + permissions: + contents: write + issues: write + pull-requests: write + id-token: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js 22.18.0 + uses: actions/setup-node@v4 + with: + node-version: 22.18.0 + cache: 'npm' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci + + - name: Run semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_CONFIG_PROVENANCE: 'true' + run: npx semantic-release diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..8af0371 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,27 @@ +{ + "branches": [ + "release", + { + "name": "main", + "prerelease": "alpha", + "channel": "alpha" + } + ], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ + "@semantic-release/npm", + { + "npmPublish": true + } + ], + [ + "@semantic-release/github", + { + "successComment": "This has been released in ${nextRelease.version}.", + "failComment": false + } + ] + ] +}