diff --git a/.github/workflows/test_gcloud_login.yaml b/.github/workflows/test_gcloud_login.yaml new file mode 100644 index 0000000..a6db72e --- /dev/null +++ b/.github/workflows/test_gcloud_login.yaml @@ -0,0 +1,12 @@ +name: Test gcloud-login +on: + push: + paths: + - "gcloud/login/**" +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run tests + run: docker build gcloud/login diff --git a/gcloud/login/Dockerfile b/gcloud/login/Dockerfile index ec6f3b0..0d89ccc 100644 --- a/gcloud/login/Dockerfile +++ b/gcloud/login/Dockerfile @@ -1,18 +1,7 @@ FROM docker:stable -LABEL version="1.0.0" - -LABEL "version"="1.0.0" -LABEL "maintainer"="Rammus Xu " -LABEL "com.github.actions.name"="GCR Login" -LABEL "com.github.actions.description"="use GCLOUD_AUTH" -LABEL "com.github.actions.icon"="terminal" -LABEL "com.github.actions.color"="green" - - -RUN apk update && \ - apk add curl bash python git && \ +RUN apk add curl bash python2 && \ curl https://sdk.cloud.google.com | bash -s -- --disable-prompts ENV PATH $PATH:/root/google-cloud-sdk/bin diff --git a/gcloud/login/action.yaml b/gcloud/login/action.yaml index 40ddb1a..f899984 100644 --- a/gcloud/login/action.yaml +++ b/gcloud/login/action.yaml @@ -1,9 +1,9 @@ # action.yml name: 'GCloud Login' -description: 'Login GCloud' +description: 'Login Google Cloud Platform' runs: using: 'docker' image: 'Dockerfile' branding: - icon: 'package' - color: 'blue' \ No newline at end of file + icon: 'package' + color: 'blue' diff --git a/gcloud/login/entrypoint.sh b/gcloud/login/entrypoint.sh index 9ea054a..097957f 100755 --- a/gcloud/login/entrypoint.sh +++ b/gcloud/login/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e echo "$GCLOUD_AUTH" | base64 -d > gcloud.json @@ -8,4 +8,4 @@ gcloud auth activate-service-account --key-file=gcloud.json # https://cloud.google.com/container-registry/docs/advanced-authentication cat gcloud.json | docker login -u _json_key --password-stdin https://asia.gcr.io -bash -c "$*" \ No newline at end of file +bash -c "$*"