Build and publish app #28
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
name: Build and publish app | |
on: | |
push: | |
workflow_dispatch: | |
env: | |
PROJECT_ID: severalnines-public | |
REGISTRY: europe-docker.pkg.dev | |
IMAGE: ${{ github.event.repository.name }} | |
REPO: cc | |
jobs: | |
build-publish: | |
name: Build, Publish | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: google-github-actions/auth@v0 | |
with: | |
credentials_json: ${{ secrets.SA_KEY }} | |
- uses: google-github-actions/setup-gcloud@v0 | |
with: | |
project_id: ${{ env.PROJECT_ID }} | |
- name: Configure docker | |
run: |- | |
gcloud --quiet auth configure-docker "$REGISTRY" | |
- name: Build docker image | |
run: |- | |
docker build \ | |
--tag "$REGISTRY/$PROJECT_ID/$REPO/$IMAGE:build-$GITHUB_RUN_NUMBER" \ | |
--tag "$REGISTRY/$PROJECT_ID/$REPO/$IMAGE:latest" \ | |
--build-arg GITHUB_SHA="$GITHUB_SHA" \ | |
--build-arg GITHUB_REF="$GITHUB_REF" \ | |
--build-arg GITHUB_RUN_NUMBER="$GITHUB_RUN_NUMBER" \ | |
-f Dockerfile \ | |
. | |
# Push the Docker image to Google Container Registry | |
- name: Publish docker image | |
run: |- | |
docker push "$REGISTRY/$PROJECT_ID/$REPO/$IMAGE:latest" |