Skip to content

v1.2.8

v1.2.8 #19

name: Release Merge Workflow
on:
pull_request:
branches:
- master
types: [ closed ]
env:
CI: true
jobs:
publish:
if: "contains(join(github.event.pull_request.labels.*.name, ','), 'Release') && github.event.pull_request.merged == true"
name: 'Publish to Cocoapods'
runs-on: 'macos-latest-large'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout repo
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Git Identity
run: |
git config --global user.name 'frontegg'
git config --global user.email 'frontegg@users.noreply.github.com'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Cocoapods
run: gem install cocoapods
- name: Set Current Version
id: set_current_version
if: startsWith(github.event.pull_request.title, 'v')
shell: bash -ex {0}
run: |
PODSPEC_FILE='./FronteggSwift.podspec'
CURRENT_VERSION=$(grep -o "s.version.*= '.*'" $PODSPEC_FILE | grep -o "'.*'" | sed "s/'//g")
echo "::set-output name=CURRENT_VERSION::${CURRENT_VERSION}"
- name: Tag Check
id: tag_check
shell: bash -ex {0}
run: |
GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/${{ steps.set_current_version.outputs.CURRENT_VERSION }}"
http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \
-H "Authorization: token ${GITHUB_TOKEN}")
if [ "$http_status_code" -ne "404" ] ; then
echo "::set-output name=exists_tag::true"
else
echo "::set-output name=exists_tag::false"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Git Tag
if: steps.tag_check.outputs.exists_tag == 'false'
uses: azu/action-package-version-to-git-tag@v1
with:
version: ${{ steps.set_current_version.outputs.CURRENT_VERSION }}
github_token: ${{ secrets.GITHUB_TOKEN }}
github_repo: ${{ github.repository }}
git_commit_sha: ${{ github.sha }}
git_tag_prefix: ""
- name: Create Release
id: create_release
if: steps.tag_check.outputs.exists_tag == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.set_current_version.outputs.CURRENT_VERSION }}
release_name: ${{ github.event.pull_request.title }}
body: |
${{ github.event.pull_request.body }}
draft: false
prerelease: false
- name: Validate to Cocoapods
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
pod lib lint --verbose
pod spec lint --verbose
- name: Publish to Trunk to Cocoapods
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
pod trunk push FronteggSwift.podspec
- uses: actions/github-script@0.8.0
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'https://github.com/${{ github.repository }}/releases/tag/v${{ steps.set_current_version.outputs.CURRENT_VERSION }} is released 🎉'
})
# - name: Notify Slack on deployment
# uses: rtCamp/action-slack-notify@v2
# env:
# SLACK_CHANNEL: Production
# SLACK_COLOR: ${{ job.status }}
# SLACK_ICON: https://avatars.githubusercontent.com/u/67857107?s=40&v=4
# SLACK_MESSAGE: '${{ github.actor }} has deployed @frontegg/react-native version: ${{ steps.set_current_version.outputs.CURRENT_VERSION }} :rocket:'
# SLACK_TITLE: '@frontegg/react-native version: ${{ steps.set_current_version.outputs.CURRENT_VERSION }} has been successfully published'
# SLACK_USERNAME: ${{ github.actor }}
# SLACK_WEBHOOK: ${{ secrets.SLACK_PRODUCTION_TOKEN }}
# MSG_MINIMAL: Commit,actions url