Skip to content

Support Automatic Release Notes #2

Support Automatic Release Notes

Support Automatic Release Notes #2

Workflow file for this run

name: Create Release
on:
pull_request:
types:
- closed
branches:
- 'main'
jobs:
test:
name: Test
if: github.event.pull_request.merged == true && github.head_ref == 'release'
uses: lytics/ios-sdk/.github/workflows/tests.yml@main
release:
name: Release
needs: test
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && github.head_ref == 'release'
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Get version
id: get-version
shell: bash
run: |
VERSION=$(grep -Eo '([0-9]+\.*)+' ${{ vars.VERSION_FILE_PATH }})
echo "current-version=$VERSION" >> $GITHUB_ENV
- name: Generate token
uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ vars.FRONTEND_PROJECT_BOT_APP_ID }}
private_key: ${{ secrets.FRONTEND_PROJECT_BOT_TOKEN }}
- name: Push tag
uses: actions/github-script@v7
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ env.current-version }}',
sha: '${{ github.sha }}'
})
- name: Create release
uses: actions/github-script@v7
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: '${{ env.current-version }}',
generate_release_notes: true,
draft: false,
prerelease: false
})