|
| 1 | +name: Release Draft |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: # checkov:skip=CKV_GHA_7 |
| 5 | + inputs: |
| 6 | + bump-type: |
| 7 | + description: Version bump type |
| 8 | + required: true |
| 9 | + type: choice |
| 10 | + options: |
| 11 | + - patch |
| 12 | + - minor |
| 13 | + - major |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: write |
| 17 | + pull-requests: write |
| 18 | + |
| 19 | +jobs: |
| 20 | + create-release-pr: |
| 21 | + name: Create Release PR |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - name: Checkout |
| 25 | + uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + fetch-depth: 0 |
| 28 | + |
| 29 | + - name: Read current version |
| 30 | + id: current-version |
| 31 | + run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT" |
| 32 | + |
| 33 | + - name: Bump version |
| 34 | + id: bump-version |
| 35 | + uses: actions-ecosystem/action-bump-semver@34e334551143a5301f38c830e44a22273c6ff5c5 # v1.0.0 |
| 36 | + with: |
| 37 | + current_version: ${{ steps.current-version.outputs.version }} |
| 38 | + level: ${{ github.event.inputs.bump-type || 'patch' }} |
| 39 | + |
| 40 | + - name: Write new version to VERSION |
| 41 | + run: echo "${{ steps.bump-version.outputs.new_version }}" > VERSION |
| 42 | + |
| 43 | + - name: Update package.json version |
| 44 | + run: npm version "${{ steps.bump-version.outputs.new_version }}" --no-git-tag-version |
| 45 | + |
| 46 | + - name: Generate changelog from git history |
| 47 | + id: changelog |
| 48 | + uses: ROKT/rokt-workflows/actions/generate-changelog@main |
| 49 | + with: |
| 50 | + version: ${{ steps.bump-version.outputs.new_version }} |
| 51 | + |
| 52 | + - name: Generate GitHub App token |
| 53 | + id: generate-token |
| 54 | + uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 |
| 55 | + with: |
| 56 | + app-id: ${{ secrets.SDK_RELEASE_GITHUB_APP_ID }} |
| 57 | + private-key: ${{ secrets.SDK_RELEASE_GITHUB_APP_PRIVATE_KEY }} |
| 58 | + owner: ${{ github.repository_owner }} |
| 59 | + repositories: | |
| 60 | + react-native-mparticle |
| 61 | +
|
| 62 | + - name: Create release PR |
| 63 | + uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 |
| 64 | + with: |
| 65 | + token: ${{ steps.generate-token.outputs.token }} |
| 66 | + branch: release/${{ steps.bump-version.outputs.new_version }} |
| 67 | + title: 'chore: release ${{ steps.bump-version.outputs.new_version }}' |
| 68 | + body: | |
| 69 | + ## Release ${{ steps.bump-version.outputs.new_version }} |
| 70 | +
|
| 71 | + These files should have changed during the release, if they didn't then this is likely an issue and should be investigated: |
| 72 | + - package.json |
| 73 | + - CHANGELOG.md |
| 74 | +
|
| 75 | + ${{ steps.changelog.outputs.release-notes }} |
| 76 | + commit-message: 'chore: bump version to ${{ steps.bump-version.outputs.new_version }}' |
0 commit comments