Create release branch #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create release branch | |
on: | |
workflow_dispatch: | |
inputs: | |
versionName: | |
description: 'Name of version (ie 1.3.0)' | |
required: true | |
jobs: | |
createrelease: | |
name: Create release branch | |
runs-on: ubuntu-latest | |
#if: contains(github.ref, 'develop') # Only for develop branch | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 | |
- name: Bundle Install | |
run: bundle install | |
- name: Create release branch | |
run: git checkout -b release/${{ github.event.inputs.versionName }} | |
- name: Initialize mandatory git config | |
run: | | |
git config user.name "Tangem Bot" | |
git config user.email mobile@tangem.com | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Bump version in Podspec file | |
run: bundle exec fastlane run version_bump_podspec path:"TangemSdk.podspec" version_number:${{ github.event.inputs.versionName }} | |
- name: Change version | |
run: echo ${{ github.event.inputs.versionName }} > VERSION | |
- name: Create Changelog | |
run: | | |
git fetch origin master:master | |
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s' --abbrev-commit --date=relative origin/master..${{ steps.extract_branch.outputs.branch }} > CHANGELOG | |
- name: Commit and push changes | |
run: | | |
git commit -am "Prepare release version ${{ github.event.inputs.versionName }}" | |
git push origin release/${{ github.event.inputs.versionName }} | |
- uses: actions/github-script@v4 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.pulls.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
head: "release/${{ github.event.inputs.versionName }}", | |
base: "master", | |
title: "Release version ${{ github.event.inputs.versionName }}", | |
}); | |
- name: Slack notification | |
if: always() | |
uses: adamkdean/simple-slack-notify@master | |
with: | |
channel: '#development-ios' | |
status: ${{ job.status }} | |
success_text: 'Card SDK: Release banch has been created' | |
failure_text: 'Card SDK: Release creation failed' | |
cancelled_text: 'Card SDK: Release creation cancelled' | |
fields: | | |
[{"title": "Source Branch", "value": "${{ steps.extract_branch.outputs.branch }}"}, | |
{"title": "Release Branch", "value": "release/${{ github.event.inputs.versionName }}"}, | |
{"title": "Initiator", "value": "${{ github.actor }}"}, | |
{"title": "Action URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}] | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DVELOPMENT_IOS }} |