diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index 82f7013..7ecf11c 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -42,23 +42,38 @@ jobs: name: app-release path: ./android/app/build/outputs/apk/release/app-release.apk - - name: Create GitHub Release + create_release: + name: Create GitHub Release + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Create Release id: create_release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ github.ref_name }} run: | - gh release create "$tag" \ - --repo="$GITHUB_REPOSITORY" \ - --title="${GITHUB_REPOSITORY#*/} ${tag#v}" \ - --generate-notes - - - name: Upload APK to GitHub Release + tag=$(echo "${GITHUB_REF#refs/tags/}") + gh release create "$tag" \ + --repo="$GITHUB_REPOSITORY" \ + --title="${GITHUB_REPOSITORY#*/} ${tag}" \ + --generate-notes + shell: bash + + upload_asset: + name: Upload APK to GitHub Release + runs-on: ubuntu-latest + needs: create_release + steps: + - name: Download Release URL + id: get_release_url + run: echo "::set-output name=upload_url::$(gh release view ${{ github.repository }} ${GITHUB_REF#refs/tags/} --json upload_url -q)" + - name: Upload Release Asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_url: ${{ needs.create_release.outputs.upload_url }} asset_path: ./android/app/build/outputs/apk/release/app-release.apk asset_name: react-native-template.apk asset_content_type: application/vnd.android.package-archive