Skip to content

publish-nym-vpn-android #36

publish-nym-vpn-android

publish-nym-vpn-android #36

name: publish-nym-vpn-android
on:
schedule:
- cron: "4 3 * * *"
workflow_dispatch:
inputs:
track:
type: choice
description: "Fastlane release track"
options:
- none
- internal
- alpha
- beta
- production
default: alpha
required: true
tag_name:
description: "Tag name for release"
required: false
default: nightly-android
release_type:
type: choice
description: "GitHub release type"
options:
- none
- prerelease
- release
default: release
required: true
push:
tags:
- 'nym-vpn-android-v*.*.*'
env:
UPLOAD_DIR_ANDROID: android_artifacts
jobs:
build-nym-vpn-android:
if: ${{ inputs.release_type != 'none' }}
uses: ./.github/workflows/build-nym-vpn-android.yml
secrets: inherit
publish-github:
if: ${{ inputs.release_type != 'none' }}
needs:
- build-nym-vpn-android
runs-on: ubuntu-22.04-arc
defaults:
run:
working-directory: nym-vpn-android
env:
# GH needed for gh cli
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
nym-vpn-android
- name: Install system dependencies
run: |
sudo apt update && sudo apt install -y gettext-base gh zip
- name: Get version code
run: |
version_code=$(grep "VERSION_CODE" ${{ github.workspace }}/nym-vpn-android/buildSrc/src/main/kotlin/Constants.kt | awk '{print $5}' | tr -d '\n')
echo "VERSION_CODE=$version_code" >> $GITHUB_ENV
- name: Set version release notes
run: |
RELEASE_NOTES="$(cat ${{ github.workspace }}/nym-vpn-android/fastlane/metadata/android/en-US/changelogs/${{ env.VERSION_CODE }}.txt)"
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$RELEASE_NOTES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# Setup TAG_NAME, which is used as a general "name"
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: |
echo "TAG_NAME=nightly-android" >> $GITHUB_ENV
- if: github.event_name == 'push'
run: echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
- name: On nightly release
if: ${{ contains(env.TAG_NAME, 'nightly') }}
run: |
echo "RELEASE_NOTES=Nightly build of the latest development version of the android client." >> $GITHUB_ENV
gh release delete nightly-android --yes || true
- name: Make download dir
run: mkdir ${{ github.workspace }}/temp
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.UPLOAD_DIR_ANDROID }}
path: ${{ github.workspace }}/temp
- name: Create release with fastlane changelog notes
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: ${{ env.RELEASE_NOTES }}
tag_name: ${{ env.TAG_NAME }}
name: ${{ github.TAG_NAME}}
draft: false
make_latest: ${{ inputs.release_type == 'release' }}
prerelease: ${{ inputs.release_type == 'prerelease' || inputs.release_type == '' }}
files: |
${{ github.workspace }}/temp/*
- name: Dispatch update for fdroid repo
if: inputs.release_type == 'release'
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PAT }}
repository: nymtech/fdroid
event-type: fdroid-update
publish-play:
if: ${{ inputs.track != 'none' && inputs.track != '' }}
# issue here: https://github.com/ruby/setup-ruby?tab=readme-ov-file#using-self-hosted-runners
#runs-on: ubuntu-22.04-arc
runs-on: ubuntu-latest
defaults:
run:
working-directory: nym-vpn-android
steps:
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2' # Not needed with a .ruby-version file
bundler-cache: true
- name: Distribute app to fastlane track 🚀
run: (cd ${{ github.workspace }}/nym-vpn-android && bundle install && bundle exec fastlane ${{ inputs.track }})