Skip to content

Commit

Permalink
add deploy analytics step to release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sdelamo committed Jun 26, 2023
1 parent 96844eb commit b9e1bb1
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,48 @@ jobs:
gcloud run deploy ${{ secrets.GCP_PROJECT_ID }}-latest --image $IMAGE_NAME --region us-central1 --platform managed --allow-unauthenticated
version="$(echo "${release_version//./}" | tr '[A-Z]' '[a-z]')"
gcloud run deploy ${{ secrets.GCP_PROJECT_ID }}-$version --image $IMAGE_NAME --region us-central1 --platform managed --allow-unauthenticated
deployanalytics:
name: Deploy Analytics To Google Cloud Run
runs-on: ubuntu-latest
needs: [build]
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set the current release version
id: release_version
run: |
release_version=${GITHUB_REF:11}
sed -i "s/^projectVersion.*$/projectVersion\=${release_version}/" gradle.properties
echo "release_version=${release_version}" >> $GITHUB_OUTPUT
- name: Login
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_email: ${{ secrets.GCP_EMAIL }}
service_account_key: ${{ secrets.GCP_CREDENTIALS }}
- name: Configure Docker
run: gcloud auth configure-docker --quiet
- name: Set up JDK
uses: actions/[email protected]
with:
distribution: 'adopt'
java-version: '11'
- name: Run Tests
run: ./gradlew grails-forge-analytics-postgres:test
- name: Build and Push Docker image and deploy to Cloud Run
env:
IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}-analytics:${{ steps.release_version.outputs.release_version }}
# To deploy native executables built with GraalVM replace dockerBuild with dockerBuildNative and dockerPush with dockerPushNative. First, try that it works locally.
run: |
./gradlew grails-forge-analytics-postgres:dockerBuild -PdockerImageName="$IMAGE_NAME"
./gradlew grails-forge-analytics-postgres:dockerPush -PdockerImageName="$IMAGE_NAME"
gcloud run deploy ${{ secrets.GCP_PROJECT_ID }}-analytics-latest --image $IMAGE_NAME --region us-central1 --platform managed --allow-unauthenticated
version="$(echo "${release_version//./}" | tr '[A-Z]' '[a-z]')"
gcloud run deploy ${{ secrets.GCP_PROJECT_ID }}-analytics-$version --image $IMAGE_NAME --region us-central1 --platform managed --allow-unauthenticated
linux:
name: Release Linux Native CLI
runs-on: ubuntu-latest
Expand Down

0 comments on commit b9e1bb1

Please sign in to comment.