diff --git a/.github/workflows/dev_deployment.yaml b/.github/workflows/dev_deployment.yaml index dbe000a..0481ca4 100644 --- a/.github/workflows/dev_deployment.yaml +++ b/.github/workflows/dev_deployment.yaml @@ -2,99 +2,102 @@ name: Build and deploy to DEV run-name: ${{ github.actor }} triggered deploy to DEV pipeline on: - push: - branches: - - 'main' + push: + branches: + #- 'main' + - 'add/exemplar-datasets' env: - PROJECT_ID: '${{ secrets.PROJECT_ID }}' - GAR_LOCATION: '${{ secrets.GAR_LOCATION }}' + PROJECT_ID: '${{ secrets.PROJECT_ID }}' + GAR_LOCATION: '${{ secrets.GAR_LOCATION }}' jobs: - build: - permissions: - contents: write - id-token: write + build: + permissions: + contents: write + id-token: write - runs-on: ubuntu-latest - environment: dev - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: main + runs-on: ubuntu-latest + environment: dev + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: add/exemplar-datasets + #ref: main - - name: Read VERSION file - id: getversion - run: | - sed -n 's/^appVersion:\(.*\)/\1/p' < chart/fma/Chart.yaml > version - echo "version=$(sed '/.*\"\(.*\)\".*/ s//\1/g' version)" >> $GITHUB_OUTPUT + - name: Read VERSION file + id: getversion + run: | + sed -n 's/^appVersion:\(.*\)/\1/p' < chart/fma/Chart.yaml > version + echo "version=$(sed '/.*\"\(.*\)\".*/ s//\1/g' version)" >> $GITHUB_OUTPUT - - name: Google Auth - id: auth - uses: 'google-github-actions/auth@v0' - with: - token_format: 'access_token' - workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' - service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' + - name: Google Auth + id: auth + uses: 'google-github-actions/auth@v0' + with: + token_format: 'access_token' + workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' + service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' - - name: Login to GAR - id: garlogin - uses: docker/login-action@v2 - with: - registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.PROJECT_ID }} - username: oauth2accesstoken - password: ${{ steps.auth.outputs.access_token }} + - name: Login to GAR + id: garlogin + uses: docker/login-action@v2 + with: + registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.PROJECT_ID }} + username: oauth2accesstoken + password: ${{ steps.auth.outputs.access_token }} - - name: Build and Push Container - id: build - shell: bash - env: - GAR_LOCATION: ${{ secrets.GAR_LOCATION }} - PROJECT_ID: ${{ secrets.PROJECT_ID }} - GAR_NAME: ${{ secrets.GAR_NAME }} - - run: |- - docker build -t '${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }}:${{ github.sha }} -t '${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }}:latest ./ - docker push --all-tags '${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }} + - name: Build and Push Container + id: build + shell: bash + env: + GAR_LOCATION: ${{ secrets.GAR_LOCATION }} + PROJECT_ID: ${{ secrets.PROJECT_ID }} + GAR_NAME: ${{ secrets.GAR_NAME }} - deploy: - needs: build - permissions: - contents: write - id-token: write + run: |- + docker build -t '${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }}:${{ github.sha }} -t '${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }}:latest ./ + docker push --all-tags '${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }} - runs-on: ubuntu-latest - environment: dev - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: main + deploy: + needs: build + permissions: + contents: write + id-token: write - - name: Google Auth - id: auth - uses: 'google-github-actions/auth@v0' - with: - token_format: 'access_token' - workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' - service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' + runs-on: ubuntu-latest + environment: dev + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: add/exemplar-datasets + #ref: main - - name: Read VERSION file - id: getversion - run: | - sed -n 's/^appVersion:\(.*\)/\1/p' < chart/fma/Chart.yaml > version - echo "version=$(sed '/.*\"\(.*\)\".*/ s//\1/g' version)" >> $GITHUB_OUTPUT - - - name: Deploy to Cloud Run - uses: actions-hub/gcloud@master - id: deploy - env: - PROJECT_ID: ${{ secrets.PROJECT_ID }} - GAR_LOCATION: ${{ secrets.GAR_LOCATION }} - GAR_NAME: ${{ secrets.GAR_NAME }} - SERVICE_NAME: '${{ secrets.SERVICE_NAME }}' - SERVICE_REGION: '${{ secrets.SERVICE_REGION }}' + - name: Google Auth + id: auth + uses: 'google-github-actions/auth@v0' + with: + token_format: 'access_token' + workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' + service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' - with: - args: run services update '${{ env.SERVICE_NAME }}' --image='${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }}:${{ github.sha }} --region='${{ env.SERVICE_REGION }}' --project='${{ env.PROJECT_ID }}' \ No newline at end of file + - name: Read VERSION file + id: getversion + run: | + sed -n 's/^appVersion:\(.*\)/\1/p' < chart/fma/Chart.yaml > version + echo "version=$(sed '/.*\"\(.*\)\".*/ s//\1/g' version)" >> $GITHUB_OUTPUT + + - name: Deploy to Cloud Run + uses: actions-hub/gcloud@master + id: deploy + env: + PROJECT_ID: ${{ secrets.PROJECT_ID }} + GAR_LOCATION: ${{ secrets.GAR_LOCATION }} + GAR_NAME: ${{ secrets.GAR_NAME }} + SERVICE_NAME: '${{ secrets.SERVICE_NAME }}' + SERVICE_REGION: '${{ secrets.SERVICE_REGION }}' + + with: + args: run services update '${{ env.SERVICE_NAME }}' --image='${{ env.GAR_LOCATION }}'-docker.pkg.dev/'${{ env.PROJECT_ID }}'/'${{ env.GAR_NAME }}'/${{ steps.getversion.outputs.version }}:${{ github.sha }} --region='${{ env.SERVICE_REGION }}' --project='${{ env.PROJECT_ID }}'