fix(ci): fix release branches creation
[e-mobility-charging-stations-simulator.git] / .github / workflows / release-please.yml
CommitLineData
2c02376b
JB
1name: Release Please
2
3on:
4 push:
5 branches:
6 - main
7
8cf1b9ef
JB
8permissions:
9 contents: write
10 pull-requests: write
11
2c02376b
JB
12jobs:
13 release-please:
14 runs-on: ubuntu-latest
8d9bfb08 15 if: github.repository == 'sap/e-mobility-charging-stations-simulator'
2c02376b
JB
16 steps:
17 - uses: googleapis/release-please-action@v4
18 id: release
19 with:
ce4b6698 20 token: ${{ secrets.WORKFLOW_TOKEN }}
2c02376b
JB
21 config-file: .github/release-please/config.json
22 manifest-file: .github/release-please/manifest.json
f727f029
JB
23 - uses: actions/checkout@v4
24 if: ${{ steps.release.outputs.release_created }}
60b14fe6 25 - name: Create tags for major and minor versions
2c02376b
JB
26 if: ${{ steps.release.outputs.release_created }}
27 run: |
28 git config user.name github-actions[bot]
29 git config user.email 41898282+github-actions[bot]@users.noreply.github.com
d295031f 30 git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
2c02376b
JB
31 git tag -d v${{ steps.release.outputs.major }} || true
32 git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
33 git push origin :v${{ steps.release.outputs.major }} || true
34 git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
35 git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}"
36 git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
37 git push origin v${{ steps.release.outputs.major }}
38 git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}