Skip to content

Commit

Permalink
fix(core): exit codes in case of connectivity issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Vacxe committed Apr 4, 2024
1 parent 497048f commit f87cabf
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 29 deletions.
79 changes: 59 additions & 20 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,65 @@
name: deploy-sonatype-snapshot
name: Deploy Release
on:
push:
branches:
- master
release:
types: [ created ]

jobs:
deploy:
release-tar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 12
uses: actions/setup-java@v1
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: 12
- name: assembleDist
run: ./gradlew distZip distTar
- name: google-play-cli.tar
uses: actions/upload-artifact@master
distribution: "temurin"
java-version: 11
- name: Build release tar
run: ./gradlew distTar
- name: Tar Checksum
run: shasum -a 256 build/distributions/google-play-cli.tar
- name: Get release information
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload artifacts to release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
name: google-play-cli.tar
path: build/distributions/google-play-cli.tar
- name: google-play-cli.zip
uses: actions/upload-artifact@master
with:
name: google-play-cli.zip
path: build/distributions/google-play-cli.zip
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./build/distributions/google-play-cli.tar
asset_name: google-play-cli.tar
asset_content_type: application/x-tar

docker-build-push:
name: Build and Push Docker image
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
needs: [ release-tar ]
steps:
- uses: actions/checkout@v4

- name: Get release information
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Docker Login
run: echo $PACKAGES_WRITE_TOKEN | docker login ghcr.io -u $USERNAME --password-stdin
env:
PACKAGES_WRITE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
USERNAME: ${{ github.actor }}

- name: Docker Build
run: docker build -t ghcr.io/vacxe/google-play-cli:$VERSION --build-arg="PLAY_CLI_VERSION=$VERSION" .
env:
VERSION: ${{ steps.get_release.outputs.tag_name }}

- name: Deploy
run: docker push ghcr.io/vacxe/google-play-cli:$VERSION
env:
VERSION: ${{ steps.get_release.outputs.tag_name }}
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
FROM adoptopenjdk/openjdk11:jdk-11.0.11_9-alpine-slim

ARG VERSION
ARG PLAY_CLI_VERSION

RUN apk update && \
apk add --no-cache jq wget unzip

RUN wget -q "https://github.com/Vacxe/google-play-cli-kt/releases/download/$VERSION/google-play-cli-$VERSION.zip" -O "google-play-cli.zip" && \
unzip "google-play-cli.zip" && \
rm "google-play-cli.zip" && \
mv google-play-cli /usr/local/

RUN chmod +x /usr/local/google-play-cli
# Install released Version from artefacts
RUN wget -q "https://github.com/Vacxe/google-play-cli-kt/releases/download/$PLAY_CLI_VERSION/google-play-cli.tar" && \
tar -xvf "google-play-cli.tar" -C /usr/local && \
rm "google-play-cli.tar"

ENV PATH="${PATH}:/usr/local/google-play-cli/bin/"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fun main(args: Array<String>) {
addCmd {
object : CliktCommand(name = "version", help = "Library version code") {
override fun run() {
println("0.3.8")
println("0.3.9")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,19 @@ abstract class BaseCommand(name: String, actionDescription: String = "") :
} else {
println(e.content)
}
exitProcess(1)
exitProcess(ExitCode.PLAY_CONSOLE_ERROR)
} catch (e: Exception) {
println(e)
exitProcess(ExitCode.DEFAULT)
}
}

abstract fun run(api: PlayStoreApi): Any?

private companion object {
object ExitCode {
const val DEFAULT = 1
const val PLAY_CONSOLE_ERROR = 2
}
}
}

0 comments on commit f87cabf

Please sign in to comment.