Files
flipper/.github/workflows/publish-android.yml
Pascal Hartig 1ec7ebbdb5 Create issue on publish failure (#2904)
Summary:
Because the publish runs aren't triggered on the main branch, we have limited visibility. Sending push notifications, webhooks or email integrations are hard, but opening an issue seems like a decent work-around for this.

We can broaden this to more publish actions as needed.

Pull Request resolved: https://github.com/facebook/flipper/pull/2904

Test Plan: Ran on my fork which generated this issue: https://github.com/passy/flipper/issues/9

Reviewed By: mweststrate

Differential Revision: D31146956

Pulled By: passy

fbshipit-source-id: 08f66bd4c96a5ea2cc5e70a7461c30e7e1f3d42e
2021-09-27 06:10:08 -07:00

67 lines
2.2 KiB
YAML

name: Publish Android
on:
push:
tags:
- v*
workflow_dispatch:
inputs:
tag:
description: "Tag to upload artifacts to"
required: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Write GPG Sec Ring
run: echo '${{ secrets.GPG_KEY_CONTENTS }}' | base64 -d > /tmp/secring.gpg
- name: Update gradle.properties
run: echo -e "signing.secretKeyRingFile=/tmp/secring.gpg\nsigning.keyId=${{ secrets.SIGNING_KEY_ID }}\nsigning.password=${{ secrets.SIGNING_PASSWORD }}\nmavenCentralPassword=${{ secrets.SONATYPE_NEXUS_PASSWORD }}\nmavenCentralUsername=${{ secrets.SONATYPE_NEXUS_USERNAME }}" >> gradle.properties
- name: Compute build cache
run: ./scripts/checksum-android.sh checksum-android.txt
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ hashFiles('checksum-android.txt') }}
- name: Build artifacts
run: ./gradlew :sample:assembleDebug :sample:assembleRelease && ./gradlew :android:assembleRelease
- name: Upload Archives
run: ./gradlew publish --no-parallel --no-daemon
- name: Release and close
run: ./gradlew closeAndReleaseRepository
- name: Clean secrets
if: always()
run: rm /tmp/secring.gpg
- name: Rename apk
run: mv android/sample/build/outputs/apk/debug/sample-debug.apk SampleApp-android.apk
- name: Attach sample APK to release
if: ${{ github.event.inputs.tag != '' }}
uses: passy/github-upload-release-artifacts-action@v2.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
created_tag: ${{ github.event.inputs.tag }}
args: 'SampleApp-android.apk'
- name: Open issue on failure
if: failure()
uses: JasonEtco/create-an-issue@v2.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
WORKFLOW_NAME: "Publish Android"
with:
filename: .github/action-failure-template.md