Deploy #15
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: Deploy | |
on: | |
workflow_run: | |
workflows: [Build] | |
types: [completed] | |
jobs: | |
version_check: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} && startsWith(github.ref, 'refs/tags/') }} | |
runs-on: ubuntu-latest | |
outputs: | |
v_tracker: ${{ steps.version.outputs.RN_TRACKER_VERSION}} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- run: echo "${{ github.event.workflow_run.head_branch }}" | |
# - name: Get tag and tracker versions | |
# id: version | |
# env: | |
# IOS_VER_FILEPATH: 'ios/Util/TrackerVersion.swift' | |
# ANDR_VER_FILEPATH: 'android/src/main/java/com/snowplow/reactnativetracker/util/TrackerVersion.kt' | |
# JS_VER_FILEPATH: 'src/jsCore.ts' | |
# run: | | |
# echo "TAG_VERSION=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_OUTPUT | |
# echo "RN_TRACKER_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
# echo "RN_IOS_TRACKER_VERSION=$(cat "${IOS_VER_FILEPATH}" | sed -n -e 's/^.*kRNTrackerVersion = "rn-\(.*\)"/\1/p')" >> $GITHUB_OUTPUT | |
# echo "RN_ANDROID_TRACKER_VERSION=$(cat "${ANDR_VER_FILEPATH}" | sed -n -e 's/^.*RN_TRACKER_VERSION = "rn-\(.*\)"/\1/p')" >> $GITHUB_OUTPUT | |
# echo "RN_JS_TRACKER_VERSION=$(cat "${JS_VER_FILEPATH}" | sed -n -e 's/^.*trackerVersion = '\''rn-\(.*\)'\'';/\1/p')" >> $GITHUB_OUTPUT | |
# - name: Fail if version mismatch | |
# run: | | |
# if [ "${{ steps.version.outputs.TAG_VERSION }}" != "${{ steps.version.outputs.RN_TRACKER_VERSION }}" ] ; then | |
# echo "Tag version (${{ steps.version.outputs.TAG_VERSION }}) doesn't match version in project (${{ steps.version.outputs.RN_TRACKER_VERSION }})" | |
# exit 1 | |
# fi | |
# if [ "${{ steps.version.outputs.TAG_VERSION }}" != "${{ steps.version.outputs.RN_IOS_TRACKER_VERSION }}" ] ; then | |
# echo "Tag version (${{ steps.version.outputs.TAG_VERSION }}) doesn't match version in project(ios) (${{ steps.version.outputs.RN_IOS_TRACKER_VERSION }})" | |
# exit 1 | |
# fi | |
# if [ "${{ steps.version.outputs.TAG_VERSION }}" != "${{ steps.version.outputs.RN_ANDROID_TRACKER_VERSION }}" ] ; then | |
# echo "Tag version (${{ steps.version.outputs.TAG_VERSION }}) doesn't match version in project(android) (${{ steps.version.outputs.RN_ANDROID_TRACKER_VERSION }})" | |
# exit 1 | |
# fi | |
# if [ "${{ steps.version.outputs.TAG_VERSION }}" != "${{ steps.version.outputs.RN_JS_TRACKER_VERSION }}" ] ; then | |
# echo "Tag version (${{ steps.version.outputs.TAG_VERSION }}) doesn't match version in project(js) (${{ steps.version.outputs.RN_JS_TRACKER_VERSION }})" | |
# exit 1 | |
# fi | |
# publish_npm: | |
# needs: ["version_check"] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# - name: Setup | |
# uses: ./.github/actions/setup | |
# - name: Build dist files | |
# run: | | |
# yarn | |
# yarn prepack | |
# - name: NPM Publish | |
# run: | | |
# if [[ "${{ needs.version_check.outputs.v_tracker }}" = *-* ]] ; then | |
# yarn publish --access public --tag next | |
# else | |
# yarn publish --access public | |
# fi | |
# env: | |
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# release: | |
# needs: ["publish_npm", "version_check"] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v2 | |
# - name: Release | |
# uses: softprops/[email protected] | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# tag_name: ${{ github.ref }} | |
# name: Version ${{ needs.version_check.outputs.v_tracker }} | |
# draft: false | |
# prerelease: ${{ contains(needs.version_check.outputs.v_tracker, '-') }} |