release #40
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: | |
| # branches: | |
| # - main | |
| # - 'feature/**' | |
| # - 'fix/**' | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: 'Release type (only for main branch)' | |
| required: false | |
| default: 'major' | |
| type: choice | |
| options: | |
| - major | |
| # Add pull_request trigger for testing on feature/fix branches | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pull-requests: read # Added for PR triggers | |
| jobs: | |
| generate-release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new_version: ${{ steps.release.outputs.new_version }} | |
| release_type: ${{ steps.release.outputs.release_type }} | |
| previous_tag: ${{ steps.release.outputs.previous_tag }} | |
| should_release: ${{ steps.release.outputs.should_release }} | |
| should_publish: ${{ steps.release.outputs.should_publish }} | |
| branch_name: ${{ steps.release.outputs.branch_name }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} | |
| - name: Generate Release | |
| id: release | |
| uses: ./.github/actions/ci/generate-release | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: generate-release | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} | |
| - name: Build Bicep Code | |
| id: build | |
| uses: ./.github/actions/ci/bicep-standard-ci | |
| with: | |
| branch_name: ${{ needs.generate-release.outputs.branch_name }} | |
| new_version: ${{ needs.generate-release.outputs.new_version }} | |
| should_publish: ${{ needs.generate-release.outputs.should_publish }} | |
| publish-release: | |
| runs-on: ubuntu-latest | |
| needs: [generate-release, build] | |
| if: needs.generate-release.outputs.should_release == 'true' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} | |
| - name: Publish Release | |
| uses: softprops/action-gh-release@v1 | |
| id: publish | |
| with: | |
| tag_name: ${{ needs.generate-release.outputs.new_version }} | |
| name: Release ${{ needs.generate-release.outputs.new_version }} | |
| body: | | |
| ## Changes | |
| - Automated release generated by workflow. | |
| - Previous tag: ${{ needs.generate-release.outputs.previous_tag }} | |
| - Release type: ${{ needs.generate-release.outputs.release_type }} | |
| - Branch: ${{ needs.generate-release.outputs.branch_name }} | |
| See [commit history](https://github.com/${{ github.repository }}/commits/${{ needs.generate-release.outputs.branch_name }}) for details. | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| continue-on-error: false | |