Update Gems 30-11-2023 #280
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
# eXo Android application continuous deployment to Appaloosa. | |
# Required Github secrets: | |
# - SSH_KEY: Private SSH Key to allow accessing to a private Github repository. | |
# - KNOWN_HOSTS: Known hosts containing Github servers fingerprints. Can be taken from existing one or Generate a one https://github.community/t/please-provide-ssh-known-hosts-for-gh-services-in-actions/16164/3. | |
# - API_TOKEN_APPALOOSA: Appaloosa Store api token | |
# - STORE_ID_APPALOOSA: Appaloosa Store id | |
# - KEY_ALIAS: Keystore alias | |
# - STORE_PASSWORD: Keystore password | |
# - KEY_PASSWORD: Certificate passoword | |
name: eXo Android Snapshot Appaloosa CI/CD | |
on: | |
push: | |
branches: [develop, acceptance] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
# Skip deployment triggered by a rebase action or technical commits | |
if: "!contains(github.event.pusher.name, 'exo-swf') || contains(github.event.head_commit.message, 'Merge Translations')" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Use SSH Key to gather certificate from a private Github repository. Use a dedicated on is recommended. | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.SSH_KEY }} | |
known_hosts: ${{ secrets.KNOWN_HOSTS }} | |
- name: Setup JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 11 | |
distribution: 'temurin' | |
- name: Setup Android SDK | |
uses: | |
android-actions/setup-android@v2 | |
# Setup Ruby 2.6 (2.7 not yet compatible with bundler) | |
- name: Setup ruby 2.6 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 | |
bundler-cache: true | |
# Install Bundler and dependencies gems | |
- name: Install bundler and dependencies | |
run: gem install bundler && bundle install | |
# Upgrade fastlane to latest version | |
- name: Upgrade fastlane | |
run: bundle update fastlane | |
# Encoding steps: https://unix.stackexchange.com/a/205643 | |
- name: Initialize Keystore | |
run: | | |
echo "$KEYSTORE_ENCODED" > /tmp/eXoPlatform.keystore.encoded | |
LC_ALL=C tr -cd 0-9a-fA-F < /tmp/eXoPlatform.keystore.encoded | xxd -r -p > /tmp/eXoPlatform.keystore | |
cat > /tmp/keystore.properties << EOF | |
storeFile=/tmp/eXoPlatform.keystore | |
storePassword=${STORE_PASSWORD} | |
keyAlias=${KEY_ALIAS} | |
keyPassword=${KEY_PASSWORD} | |
EOF | |
env: | |
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} | |
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
KEYSTORE_ENCODED: ${{ secrets.KEYSTORE_ENCODED }} | |
- name: Generate new version | |
env: | |
TAG_PREFIX: "6.2-DEV" | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "eXo Software Factory" | |
git fetch --tags | |
CURRENT_TAG=$(git tag -l | grep ${TAG_PREFIX} | tail -n 1) | |
if [ -z "${CURRENT_TAG}" ]; then | |
echo "NEW_TAG=${TAG_PREFIX}01" >> $GITHUB_ENV | |
INDEX="01" | |
else | |
INDEX=$((10#$(echo $CURRENT_TAG | sed "s|.*${TAG_PREFIX}||"))) | |
((INDEX++)) | |
[ "${INDEX}" -lt "10" ] && INDEX="0${INDEX}" | |
echo "NEW_TAG=${TAG_PREFIX}${INDEX}" >> $GITHUB_ENV | |
fi | |
echo "INDEX=${INDEX}" >> $GITHUB_ENV | |
- name: Set Android Application version | |
run: | | |
echo "EXO_APP_ENVIRONMENT=${NEW_TAG}" >> $GITHUB_ENV | |
sed -E -i -e "s/versionCode.*/versionCode $((10#$INDEX))/" app/build.gradle | |
# Deploy eXo Android bundle to appalossa store | |
- name: "Deploy eXo Snapshot to appaloosa" | |
uses: maierj/[email protected] | |
with: | |
lane: "android ci_dev" | |
env: | |
APPALOOSA_EXO_API_TOKEN: ${{ secrets.API_TOKEN_APPALOOSA }} | |
APPALOOSA_EXO_STORE_ID: ${{ secrets.STORE_ID_APPALOOSA }} | |
GOOGLE_PLAY_EXO_KEYSTORE_PROPS: /tmp/keystore.properties | |
- name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.SWF_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.SWF_GPG_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
git_tag_gpgsign: true | |
- name: Create tag and Push it to repository | |
run: git tag ${NEW_TAG} -m '' && git push origin ${NEW_TAG} |