Skip to content

Deploy a Production Release #10

Deploy a Production Release

Deploy a Production Release #10

Workflow file for this run

name: Deploy a Production Release
on:
workflow_run:
workflows: [ Build ]
types:
- completed
branches: [ main ]
workflow_dispatch: {}
permissions:
contents: read
jobs:
read_version:
runs-on: ubuntu-latest
name: Get Version Number
outputs:
version: ${{ steps.read_version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: Download workflow artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
branch: main
allow_forks: false
- name: Copy File
run: cp ./**/version .
- name: Read Version
id: read_version
run: echo "version=$(cat version | tr -d '\r\n')" >> "$GITHUB_OUTPUT"
deploy_google:
runs-on: ubuntu-latest
name: Deploy to Google Play
needs: read_version
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: Download workflow artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
branch: main
allow_forks: false
- name: Copy Files
run: cp ./**/*.aab .
- name: Upload
uses: r0adkll/upload-google-play@v1.0.19
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICES_ACCOUNT_JSON }}
packageName: app.rosy_crow
releaseFiles: app.rosy_crow-Signed.aab
releaseName: ${{ needs.read_version.outputs.version }}
track: production
status: completed
deploy_fdroid:
runs-on: ubuntu-latest
name: Deploy to F-Droid
needs: read_version
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: Store SSH Key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.FDROID_REPO_SSH_KEY }}" >> ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
- name: Create Config File
run: |
cd fdroid
cp config_template.yml config.yml
chmod 0600 config.yml
echo "" >> config.yml
echo "keystorepass: ${{ secrets.ROSYCROW_SIGNING_KEY_PASSWORD }}" >> config.yml
echo "keypass: ${{ secrets.ROSYCROW_SIGNING_KEY_PASSWORD }}" >> config.yml
- name: Get the Repo Contents
run: |
mkdir -p fdroid/repo
cd fdroid/repo
echo "get -R repo/*.apk" | sftp -o StrictHostKeyChecking=no github@rosy-crow.app:/var/www/rosy-crow/fdroid
- name: Download workflow artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
branch: main
allow_forks: false
- name: Copy Package into Repo
run: |
cp ./**/*.apk .
cp app.rosy_crow-Signed.apk fdroid/repo/app.rosy_crow-Signed_${{ needs.read_version.outputs.version }}.apk
- name: Install Tools
run: |
sudo add-apt-repository ppa:fdroid/fdroidserver
sudo apt-get update
sudo apt-get install fdroidserver
- name: Set Current Version and VersionCode
run: |
export VERSION_CODE=$(aapt dump badging fdroid/repo/app.rosy_crow-Signed_${{ needs.read_version.outputs.version }}.apk | sed -E -e "s/.*versionCode='([0-9]+)'.*/\1/g" | head -n 1)
echo "Version: ${{ needs.read_version.outputs.version }} VersionCode: $VERSION_CODE"
echo "" >> fdroid/metadata/app.rosy_crow.yml
echo "CurrentVersion: ${{ needs.read_version.outputs.version }}" >> fdroid/metadata/app.rosy_crow.yml
echo "CurrentVersionCode: $VERSION_CODE" >> fdroid/metadata/app.rosy_crow.yml
- name: Update F-Droid Index
run: |
cd fdroid
fdroid update -c
fdroid update
- name: Upload Repo
run: |
cd fdroid
echo "put -R repo" | sftp -o StrictHostKeyChecking=no github@rosy-crow.app:/var/www/rosy-crow/fdroid
create_tag:
runs-on: ubuntu-latest
name: Tag Release
permissions: write-all
needs:
- read_version
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: Create Tag
uses: anothrNick/github-tag-action@1.67.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # if you don't want to set write permissions use a PAT token
WITH_V: false
CUSTOM_TAG: ${{ needs.read_version.outputs.version }}