# This workflow runs whenever the release PR is merged. It includes post-release communication processes like # posting to slack, the website, community forums, etc. # Only things that happen after a release is completed and all of the necessary code changes (like the changelog) are made. name: Post-release on: workflow_dispatch: inputs: dry_run: required: false default: true type: boolean version: required: true latest: type: boolean default: false pull_request: types: - closed branches: - 'main' - 'release-*.*.*' jobs: setup: if: ${{ github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/')) }} name: Setup and establish latest outputs: version: ${{ steps.output.outputs.version }} release_branch: ${{ steps.output.outputs.release_branch }} dry_run: ${{ steps.output.outputs.dry_run }} latest: ${{ steps.output.outputs.latest }} runs-on: ubuntu-latest steps: # The github-release action expects a `LATEST` value of a string of either '1' or '0' - if: ${{ github.event_name == 'workflow_dispatch' }} run: | echo setting up GITHUB_ENV for ${{ github.event_name }} echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV echo "DRY_RUN=${{ inputs.dry_run }}" >> $GITHUB_ENV echo "LATEST=${{ inputs.latest && '1' || '0' }}" >> $GITHUB_ENV - if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') }} run: | echo "VERSION=$(echo ${{ github.head_ref }} | sed -e 's/release\/.*\//v/g')" >> $GITHUB_ENV echo "DRY_RUN=${{ contains(github.event.pull_request.labels.*.name, 'release/dry-run') }}" >> $GITHUB_ENV echo "LATEST=${{ contains(github.event.pull_request.labels.*.name, 'release/latest') && '1' || '0' }}" >> $GITHUB_ENV - id: output run: | echo "dry_run: $DRY_RUN" echo "latest: $LATEST" echo "version: $VERSION" echo "release_branch=$(echo $VERSION | sed -s 's/^v/release-/g')" >> "$GITHUB_OUTPUT" echo "dry_run=$DRY_RUN" >> "$GITHUB_OUTPUT" echo "latest=$LATEST" >> "$GITHUB_OUTPUT" echo "version=$VERSION" >> "$GITHUB_OUTPUT" create_next_release_branch_grafana: name: Create next release branch (Grafana) needs: setup uses: ./.github/workflows/create-next-release-branch.yml secrets: GRAFANA_DELIVERY_BOT_APP_ID: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_ID }} GRAFANA_DELIVERY_BOT_APP_PEM: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_PEM }} with: ownerRepo: 'grafana/grafana' source: ${{ needs.setup.outputs.release_branch }} create_next_release_branch_enterprise: name: Create next release branch (Grafana Enterprise) needs: setup uses: ./.github/workflows/create-next-release-branch.yml secrets: GRAFANA_DELIVERY_BOT_APP_ID: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_ID }} GRAFANA_DELIVERY_BOT_APP_PEM: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_PEM }} with: ownerRepo: 'grafana/grafana-enterprise' source: ${{ needs.setup.outputs.release_branch }} migrate_prs_grafana: needs: - setup - create_next_release_branch_grafana uses: ./.github/workflows/migrate-prs.yml secrets: GRAFANA_DELIVERY_BOT_APP_ID: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_ID }} GRAFANA_DELIVERY_BOT_APP_PEM: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_PEM }} with: ownerRepo: 'grafana/grafana' from: ${{ needs.setup.outputs.release_branch }} to: ${{ needs.create_next_release_branch_grafana.outputs.branch }} migrate_prs_enterprise: needs: - setup - create_next_release_branch_enterprise uses: ./.github/workflows/migrate-prs.yml secrets: GRAFANA_DELIVERY_BOT_APP_ID: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_ID }} GRAFANA_DELIVERY_BOT_APP_PEM: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_PEM }} with: ownerRepo: 'grafana/grafana-enterprise' from: ${{ needs.setup.outputs.release_branch }} to: ${{ needs.create_next_release_branch_enterprise.outputs.branch }} post_changelog_on_forum: needs: setup uses: ./.github/workflows/community-release.yml secrets: GRAFANA_MISC_STATS_API_KEY: ${{ secrets.GRAFANA_MISC_STATS_API_KEY }} GRAFANABOT_FORUM_KEY: ${{ secrets.GRAFANABOT_FORUM_KEY }} with: version: ${{ needs.setup.outputs.version }} dry_run: ${{ needs.setup.outputs.dry_run == 'true' }} create_github_release: # a github release requires a git tag # The github-release action retrieves the changelog using the /repos/grafana/grafana/contents/CHANGELOG.md API # endpoint. needs: setup uses: ./.github/workflows/github-release.yml with: version: ${{ needs.setup.outputs.version }} dry_run: ${{ needs.setup.outputs.dry_run == 'true' }} latest: ${{ needs.setup.outputs.latest }} post_on_slack: needs: setup runs-on: ubuntu-latest steps: - run: | echo announce on slack that ${{ needs.setup.outputs.version }} has been released echo dry run: ${{ needs.setup.outputs.dry_run }}