o-lenczyk is building dietly-ui #66
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env: | |
db_name: ${{vars.DB_NAME}} | |
name: build dietly-ui | |
run-name: ${{ github.actor }} is building dietly-ui | |
on: [push] | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
environment: dev | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: build docker image | |
run: docker build -t europe-central2-docker.pkg.dev/gcp101713-michalpiasecki/dietly/ui:${{ github.sha }} . | |
- name: install gcloud | |
run: curl https://sdk.cloud.google.com | bash -s -- --disable-prompts | |
- name: set credentials | |
run: echo "${{secrets.GOOGLE_APPLICATION_CREDENTIALS}}" | base64 -d > key.json | |
- name: activate service account | |
run: gcloud auth activate-service-account --key-file key.json | |
- name: list authorized accounts | |
run: gcloud auth list | |
- name: configure docker | |
run: gcloud auth configure-docker europe-central2-docker.pkg.dev | |
- name: push docker image | |
run: docker push europe-central2-docker.pkg.dev/gcp101713-michalpiasecki/dietly/ui:${{ github.sha }} | |
- name: retag image | |
if: startsWith( github.ref, 'refs/tags/') | |
run: docker tag europe-central2-docker.pkg.dev/gcp101713-michalpiasecki/dietly/ui:${{ github.sha }} europe-central2-docker.pkg.dev/gcp101713-michalpiasecki/dietly/ui:$(awk -F"/" '{print $3}' <<< ${{ github.ref }}) | |
- name: push tag | |
if: startsWith( github.ref, 'refs/tags/') | |
run: docker push europe-central2-docker.pkg.dev/gcp101713-michalpiasecki/dietly/ui:$(awk -F"/" '{print $3}' <<< ${{ github.ref }}) | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build-and-push | |
environment: dev | |
steps: | |
- name: deploy | |
if: startsWith( github.ref, 'refs/tags/') | |
run: echo "tag ${{ github.ref }}" | |