name: Build Release Assets on: release: types: [released] workflow_dispatch: inputs: tag_name: description: 'Release tag (e.g., 1.2.3)' required: true type: string permissions: contents: write jobs: test: name: Quality Gate runs-on: ubuntu-latest steps: - name: Resolve tag name id: tag run: | TAG="${{ github.event.inputs.tag_name || github.event.release.tag_name }}" echo "name=${TAG}" >> "$GITHUB_OUTPUT" - name: Checkout code uses: actions/checkout@v7 with: ref: ${{ steps.tag.outputs.name }} - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '8.1' coverage: none - name: Run unit tests run: php tests/phpunit.phar -c tests/phpunit.xml.dist build: needs: test runs-on: ubuntu-latest outputs: tag_name: ${{ steps.tag.outputs.name }} release_name: ${{ github.event.release.name || steps.tag.outputs.name }} steps: - name: Resolve tag name id: tag run: | TAG="${{ github.event.inputs.tag_name || github.event.release.tag_name }}" echo "name=${TAG}" >> "$GITHUB_OUTPUT" - name: Checkout code uses: actions/checkout@v7 with: ref: ${{ steps.tag.outputs.name }} fetch-depth: 0 - name: Determine previous tag id: prev_tag run: | CURRENT_TAG="${{ steps.tag.outputs.name }}" PREV_TAG=$(git tag --sort=-v:refname | awk -v cur="$CURRENT_TAG" 'found { print; exit } $0 == cur { found=1 }') if [ -z "$PREV_TAG" ]; then echo "No previous tag found — update archives will be skipped" echo "found=false" >> "$GITHUB_OUTPUT" else echo "Previous tag: ${PREV_TAG}" echo "tag=${PREV_TAG}" >> "$GITHUB_OUTPUT" echo "found=true" >> "$GITHUB_OUTPUT" fi - name: Clean dist directory run: make new - name: Build LB archive run: make lb${{ steps.prev_tag.outputs.found == 'true' && format(' LAST_TAG="{0}"', steps.prev_tag.outputs.tag) || '' }} - name: Build MAIN archive run: make main${{ steps.prev_tag.outputs.found == 'true' && format(' LAST_TAG="{0}"', steps.prev_tag.outputs.tag) || '' }} - name: Upload assets to release uses: softprops/action-gh-release@v3 with: tag_name: ${{ steps.tag.outputs.name }} files: dist/* notify: needs: build uses: ./.github/workflows/release-notifier.yml with: tag_name: ${{ needs.build.outputs.tag_name }} release_name: ${{ needs.build.outputs.release_name }} is_prerelease: false secrets: inherit