|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '[0-9]*.[0-9]*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + issues: write |
| 11 | + pull-requests: write |
| 12 | + id-token: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + release: |
| 16 | + name: Release Please |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Fetch ephemeral GitHub token |
| 20 | + id: fetch-token |
| 21 | + uses: elastic/ci-gh-actions/fetch-github-token@8a7604dfdd4e7fe21f969bfe9ff96e17635ea577 # v1.0.0 |
| 22 | + with: |
| 23 | + vault-instance: "ci-prod" |
| 24 | + |
| 25 | + - uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0 |
| 26 | + id: release-please |
| 27 | + with: |
| 28 | + config-file: .github/release-please-config.json |
| 29 | + manifest-file: .github/.release-please-manifest.json |
| 30 | + target-branch: ${{ github.ref_name }} |
| 31 | + token: ${{ steps.fetch-token.outputs.token }} |
| 32 | + |
| 33 | + - name: Checkout repository |
| 34 | + if: steps.release-please.outputs.release_created == 'true' |
| 35 | + uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 |
| 36 | + with: |
| 37 | + token: ${{ steps.fetch-token.outputs.token }} |
| 38 | + |
| 39 | + - name: Bump Version Snapshot |
| 40 | + id: bump-version |
| 41 | + if: steps.release-please.outputs.release_created == 'true' |
| 42 | + run: | |
| 43 | + NEXT_PATCH=$((${{ steps.release-please.outputs.patch }} + 1)) |
| 44 | + NEXT_VERSION="${{ steps.release-please.outputs.major }}.${{ steps.release-please.outputs.minor }}.${NEXT_PATCH}-SNAPSHOT" |
| 45 | + echo "Next version: $NEXT_VERSION" |
| 46 | + sed -i "s/const Version = \".*\"/const Version = \"$NEXT_VERSION\"/" internal/version/version.go |
| 47 | + echo "next_version=$NEXT_VERSION" >> $GITHUB_OUTPUT |
| 48 | +
|
| 49 | +
|
| 50 | + - name: Create Version Bump Pull Request |
| 51 | + if: steps.release-please.outputs.release_created == 'true' |
| 52 | + uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412 # v7.0.9 |
| 53 | + with: |
| 54 | + token: ${{ steps.fetch-token.outputs.token }} |
| 55 | + commit-message: 'chore: bump version to ${{ steps.bump-version.outputs.next_version }}' |
| 56 | + branch: chore/bump-version-${{ steps.bump-version.outputs.next_version }} |
| 57 | + delete-branch: true |
| 58 | + title: 'chore: bump version to ${{ steps.bump-version.outputs.next_version }}' |
| 59 | + body: | |
| 60 | + Bumps version to ${{ steps.bump-version.outputs.next_version }} after release ${{ steps.release-please.outputs.major }}.${{ steps.release-please.outputs.minor }}.${{ steps.release-please.outputs.patch }}. |
| 61 | + |
| 62 | + Auto-generated by GitHub Actions. |
| 63 | + base: ${{ github.ref_name }} |
| 64 | + committer: 'Elastic Machine <elasticmachine@users.noreply.github.com>' |
| 65 | + author: 'Elastic Machine <elasticmachine@users.noreply.github.com>' |
0 commit comments