Skip to content

ci: fix GOOGLE_DRIVE_TEAM_FOLDER #15

ci: fix GOOGLE_DRIVE_TEAM_FOLDER

ci: fix GOOGLE_DRIVE_TEAM_FOLDER #15

Workflow file for this run

name: 'GitHub Actions'
'on':
- push
concurrency: 'ci-${{ github.ref }}'
env:
APP_IMAGE: keboola/google-drive-writer
KBC_DEVELOPERPORTAL_VENDOR: keboola
KBC_DEVELOPERPORTAL_APP: keboola.wr-google-drive
KBC_DEVELOPERPORTAL_USERNAME: keboola+wr_google_drive_gha
KBC_DEVELOPERPORTAL_PASSWORD: '${{ secrets.KBC_DEVELOPERPORTAL_PASSWORD }}'
CLIENT_ID: 383797098604-tctsequl2v6r5d6vh9m4lhrf8hae59ai.apps.googleusercontent.com
CLIENT_SECRET: '${{ secrets.CLIENT_SECRET }}'
ACCESS_TOKEN: '${{ secrets.ACCESS_TOKEN }}'
REFRESH_TOKEN: '${{ secrets.REFRESH_TOKEN }}'
GOOGLE_DRIVE_FOLDER: 0B8ceg4OWLR3lRWhlekZsbTNnY2M
GOOGLE_DRIVE_TEAM_FOLDER: 0ADr3AHEcUW6NUk9PVA
DOCKERHUB_USER: '${{ secrets.DOCKERHUB_USER }}'
DOCKERHUB_TOKEN: '${{ secrets.DOCKERHUB_TOKEN }}'
KBC_STORAGE_TOKEN: '${{ secrets.KBC_STORAGE_TOKEN }}'
KBC_TEST_PROJECT_URL: ''
KBC_TEST_PROJECT_CONFIGS: ''
jobs:
build:
runs-on: ubuntu-latest
outputs:
app_image_tag: '${{ steps.tag.outputs.app_image_tag }}'
is_semantic_tag: '${{ steps.tag.outputs.is_semantic_tag }}'
steps:
-
name: 'Check out the repo'
uses: actions/checkout@v2
-
name: 'Print Docker version'
run: 'docker -v'
-
name: 'Docker login'
if: env.DOCKERHUB_TOKEN
run: 'docker login --username "$DOCKERHUB_USER" --password "$DOCKERHUB_TOKEN"'
-
name: 'Build image'
run: 'docker build -t $APP_IMAGE .'
-
name: 'Set image tag'
id: tag
run: |
TAG="${GITHUB_REF##*/}"
IS_SEMANTIC_TAG=$(echo "$TAG" | grep -q '^v\?[0-9]\+\.[0-9]\+\.[0-9]\+$' && echo true || echo false)
echo "Tag = '$TAG', is semantic tag = '$IS_SEMANTIC_TAG'"
echo "::set-output name=app_image_tag::$TAG"
echo "::set-output name=is_semantic_tag::$IS_SEMANTIC_TAG"
-
name: 'Push image to ECR'
uses: keboola/action-push-to-ecr@master
with:
vendor: '${{ env.KBC_DEVELOPERPORTAL_VENDOR }}'
app_id: '${{ env.KBC_DEVELOPERPORTAL_APP }}'
username: '${{ env.KBC_DEVELOPERPORTAL_USERNAME }}'
password: '${{ env.KBC_DEVELOPERPORTAL_PASSWORD }}'
tag: '${{ steps.tag.outputs.app_image_tag }}'
push_latest: '${{ steps.tag.outputs.is_semantic_tag }}'
source_image: '${{ env.APP_IMAGE }}'
tests:
needs: build
runs-on: ubuntu-latest
steps:
-
name: 'Check out the repo'
uses: actions/checkout@v2
-
name: 'Pull image from ECR'
uses: keboola/action-pull-from-ecr@master
with:
vendor: '${{ env.KBC_DEVELOPERPORTAL_VENDOR }}'
app_id: '${{ env.KBC_DEVELOPERPORTAL_APP }}'
username: '${{ env.KBC_DEVELOPERPORTAL_USERNAME }}'
password: '${{ env.KBC_DEVELOPERPORTAL_PASSWORD }}'
tag: '${{ needs.build.outputs.app_image_tag }}'
target_image: '${{ env.APP_IMAGE}}'
tag_as_latest: true
-
name: 'Run tests'
run: |
docker run \
-e CLIENT_ID \
-e CLIENT_SECRET \
-e ACCESS_TOKEN \
-e REFRESH_TOKEN \
-e GOOGLE_DRIVE_FOLDER \
-e GOOGLE_DRIVE_TEAM_FOLDER \
${{env.APP_IMAGE}} composer ci
env:
CLIENT_ID: '${{ env.CLIENT_ID }}'
CLIENT_SECRET: '${{ env.CLIENT_SECRET }}'
ACCESS_TOKEN: '${{ env.ACCESS_TOKEN }}'
REFRESH_TOKEN: '${{ env.REFRESH_TOKEN }}'
GOOGLE_DRIVE_FOLDER: '${{ env.GOOGLE_DRIVE_FOLDER }}'
GOOGLE_DRIVE_TEAM_FOLDER: '${{ env.GOOGLE_DRIVE_TEAM_FOLDER }}'
tests-in-kbc:
needs: build
runs-on: ubuntu-latest
steps:
-
name: 'Run KBC test jobs'
if: 'env.KBC_STORAGE_TOKEN && env.KBC_TEST_PROJECT_CONFIGS'
uses: keboola/action-run-configs-parallel@master
with:
token: '${{ env.KBC_STORAGE_TOKEN }}'
componentId: '${{ env.KBC_DEVELOPERPORTAL_APP }}'
tag: '${{ needs.build.outputs.app_image_tag }}'
configs: '${{ env.KBC_TEST_PROJECT_CONFIGS }}'
deploy:
needs:
- build
- tests
- tests-in-kbc
runs-on: ubuntu-latest
if: 'startsWith(github.ref, ''refs/tags/'') && needs.build.outputs.is_semantic_tag == ''true'''
steps:
-
name: 'Set tag in the Deloper Portal'
uses: keboola/action-set-tag-developer-portal@master
with:
vendor: '${{ env.KBC_DEVELOPERPORTAL_VENDOR }}'
app_id: '${{ env.KBC_DEVELOPERPORTAL_APP }}'
username: '${{ env.KBC_DEVELOPERPORTAL_USERNAME }}'
password: '${{ env.KBC_DEVELOPERPORTAL_PASSWORD }}'
tag: '${{ needs.build.outputs.app_image_tag }}'