Skip to content

deploy

deploy #31

Workflow file for this run

name: deploy
on:
push:
tags:
- '*'
jobs:
run_snyk:
if: ${{ contains(github.ref, 'rc') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v3
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 8
- name: Build local image, which is needed to run Snyk
run: sbt "project distroless" docker:publishLocal
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/docker@master
with:
image: "snowplow/snowplow-google-cloud-storage-loader:${{ github.ref_name }}-distroless"
args: "--app-vulns --org=data-processing-new"
command: monitor
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
deploy_docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v3
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 8
- name: Get current version
id: ver
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
- name: Stage the Docker build
run: sbt docker:stage
- name: Stage the Distroless Docker build
run: sbt 'project distroless' docker:stage
- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: snowplow/snowplow-google-cloud-storage-loader
tags: |
type=raw,value=latest,enable=${{ !contains(steps.ver.outputs.tag, 'rc') }}
type=raw,value=${{ steps.ver.outputs.tag }}
flavor: |
latest=false
- name: Docker metadata distroless
id: meta-distroless
uses: docker/metadata-action@v3
with:
images: snowplow/snowplow-google-cloud-storage-loader
tags: |
type=raw,value=latest-distroless,enable=${{ !contains(steps.ver.outputs.tag, 'rc') }}
type=raw,value=${{ steps.ver.outputs.tag }}-distroless
flavor: |
latest=false
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push image
uses: docker/build-push-action@v2
with:
context: target/docker/stage
file: target/docker/stage/Dockerfile
platforms: linux/amd64,linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
push: true
- name: Push distroless image
uses: docker/build-push-action@v2
with:
context: distroless/target/docker/stage
file: distroless/target/docker/stage/Dockerfile
platforms: linux/amd64,linux/arm64/v8
tags: ${{ steps.meta-distroless.outputs.tags }}
push: true
deploy_template:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v3
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 8
- name: Authorize gcp sdk
id: auth
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON_BASE64 }}'
- name: Setup gcp sdk
uses: google-github-actions/setup-gcloud@v0
with:
project_id: snowplow-assets
- name: Get current version
id: ver
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
- name: Publish asset
run: |
sbt "runMain com.snowplowanalytics.storage.googlecloudstorage.loader.CloudStorageLoader --project=snowplow-assets \
--templateLocation=gs://sp-hosted-assets/4-storage/snowplow-google-cloud-storage-loader/${{ steps.ver.outputs.tag }}/SnowplowGoogleCloudStorageLoaderTemplate-${{ steps.ver.outputs.tag }} \
--stagingLocation=gs://sp-hosted-assets/4-storage/snowplow-google-cloud-storage-loader/${{ steps.ver.outputs.tag }}/staging \
--runner=DataflowRunner \
--tempLocation=gs://sp-hosted-assets/tmp \
--autoscalingAlgorithm=THROUGHPUT_BASED \
--numWorkers=1 \
--numShards=1 \
--diskSizeGb=30 \
--workerMachineType=n1-standard-1 \
--region=europe-west1"
deploy_github:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v3
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 8
- name: Get current version
id: ver
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
- name: Build asset
run: sbt universal:packageBin
- name: Create GitHub release & Attach artifacts
uses: softprops/action-gh-release@v1
with:
name: "Version ${{ steps.ver.outputs.tag }}"
tag_name:
files: target/universal/snowplow-google-cloud-storage-loader-${{ steps.ver.outputs.tag }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}