Add auto-release workflow for automated tagging #1
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: Auto Release | |
| # Triggers automatic tagging when PRs are merged into main, | |
| # or allows manual release triggering. | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (leave empty to extract from build.gradle.kts)' | |
| required: false | |
| type: string | |
| env: | |
| BUILD_GRADLE_PATH: "VungleAdapter/build.gradle.kts" | |
| jobs: | |
| auto-release: | |
| # Only run if manual trigger OR PR was merged (not just closed) | |
| if: | | |
| github.event_name == 'workflow_dispatch' || | |
| github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: auto-release-${{ github.repository }} | |
| cancel-in-progress: false | |
| steps: | |
| - name: Validate branch name | |
| id: validate | |
| if: github.event_name == 'pull_request' | |
| env: | |
| BRANCH: ${{ github.event.pull_request.head.ref }} | |
| run: | | |
| if [[ $BRANCH =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then | |
| echo "valid=true" >> $GITHUB_OUTPUT | |
| echo "Branch '$BRANCH' matches version pattern" | |
| else | |
| echo "valid=false" >> $GITHUB_OUTPUT | |
| echo "Branch '$BRANCH' does not match version pattern - skipping release" | |
| fi | |
| - name: Trigger auto-release | |
| if: github.event_name == 'workflow_dispatch' || steps.validate.outputs.valid == 'true' | |
| uses: peter-evans/repository-dispatch@v3 | |
| with: | |
| token: ${{ secrets.GITHUBSERVICETOKEN }} | |
| repository: ChartBoost/chartboost-mediation-android-actions | |
| event-type: auto-release | |
| client-payload: | | |
| { | |
| "repository": "${{ github.repository }}", | |
| "token": "${{ secrets.ACCESS_TOKEN }}", | |
| "version": "${{ github.event.inputs.version || '' }}", | |
| "build_gradle_path": "${{ env.BUILD_GRADLE_PATH }}" | |
| } | |
| - name: Log release trigger | |
| if: github.event_name == 'workflow_dispatch' || steps.validate.outputs.valid == 'true' | |
| env: | |
| VERSION: ${{ github.event.inputs.version || 'from build.gradle.kts' }} | |
| run: | | |
| echo "## Release Triggered" >> $GITHUB_STEP_SUMMARY | |
| echo "- Repository: ${{ github.repository }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- Version: $VERSION" >> $GITHUB_STEP_SUMMARY |