Skip to content

Automated Release Workflow #40

Automated Release Workflow

Automated Release Workflow #40

name: Publish
on:
# push:
# branches: # Change this to master once everything is setup.
# - 'beta'
# # Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
# Note: This code is specifically needed for generating GitHub releases. The release type (alpha or beta) for the app store release
# is automatically determined based on the distribution channel from which the release has been downloaded.
# Therefore, this section is exclusive to GitHub releases and is not required for app store releases.
identifier:
description: 'Post-fix identifier'
required: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setting environment variables for date, ads, unity, and version
run: |
echo "DATE_TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
echo "IAP_NO_ADS=$(echo ${{ secrets.IAP_NO_ADS }})" >> $GITHUB_ENV
echo "IAP_TAG_EDITOR_PRO=$(echo ${{ secrets.IAP_TAG_EDITOR_PRO }})" >> $GITHUB_ENV
echo "PLACEMENT_BANNER_1=$(echo ${{ secrets.PLACEMENT_BANNER_1 }})" >> $GITHUB_ENV
echo "PLACEMENT_BANNER_2=$(echo ${{ secrets.PLACEMENT_BANNER_2 }})" >> $GITHUB_ENV
echo "PLACEMENT_INTERSTITIAL=$(echo ${{ secrets.PLACEMENT_INTERSTITIAL }})" >> $GITHUB_ENV
echo "PLAY_CONSOLE_APP_RSA_KEY=$(echo ${{ secrets.PLAY_CONSOLE_APP_RSA_KEY }})" >> $GITHUB_ENV
echo "UNITY_APP_ID=$(echo ${{ secrets.UNITY_APP_ID }})" >> $GITHUB_ENV
echo "GIT_TAG=$(grep -E "versionName\s*=?\s*['\"]" "app/build.gradle.kts" | awk -F"['\"]" '{print $2}')"-${{ github.event.inputs.identifier }} >> $GITHUB_ENV
sed -i "s/versionName\s*=\s*['\"][^'\"]*['\"]\s*/versionName = 0.0.0/g" app/build.gradle.kts
echo "APP_VER=$(grep -E "versionName\s*=?\s*['\"]" "app/build.gradle.kts" | awk -F"['\"]" '{print $2}')" >> $GITHUB_ENV
- name: Displaying the environment variable to the console for debugging
run: |
echo $UNITY_APP_ID | sed 's/./&‌/g'
echo $PLACEMENT_BANNER_1 | sed 's/./&‌/g'
echo $PLACEMENT_BANNER_2 | sed 's/./&‌/g'
echo $PLACEMENT_INTERSTITIAL | sed 's/./&‌/g'
echo $PLAY_CONSOLE_APP_RSA_KEY | sed 's/./&‌/g'
echo $IAP_NO_ADS | sed 's/./&‌/g'
echo $IAP_TAG_EDITOR_PRO | sed 's/./&‌/g'
echo $GIT_TAG | sed 's/./&‌/g'
echo $APP_VER | sed 's/./&‌/g'