-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a60738c
commit 2c97b20
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Deploy to GKE | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
build: | ||
name: Building and push image to gcr | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Configure GCR credentials | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
create_credentials_file: true | ||
project_id: ${{ secrets.PROJECT_ID }} | ||
credentials_json: ${{ secrets.GCR_SERVICE_ACCOUNT_KEY }} | ||
|
||
- name: Set up Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v2 | ||
|
||
- name: Configure Docker client | ||
run: |- | ||
gcloud auth configure-docker --quiet | ||
- name: Get tag | ||
run: echo "tag=$(echo ${GITHUB_REF_NAME})" >>$GITHUB_OUTPUT | ||
id: get-tag | ||
|
||
- name: Get short sha | ||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
id: get-short | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build image discord-bot and push it | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
platforms: linux/amd64 | ||
file: Dockerfile | ||
target: prod | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
tags: | | ||
eu.gcr.io/spotistats-a49da/discord-bot:${{ steps.get-tag.outputs.tag }}-${{ steps.get-short.outputs.sha_short }} | ||
eu.gcr.io/spotistats-a49da/discord-bot:latest | ||
- name: Repository Dispatch | ||
uses: peter-evans/repository-dispatch@v3 | ||
with: | ||
token: ${{ secrets.PAT }} | ||
repository: statsfm/argocd | ||
event-type: image-updates-discord-bot | ||
client-payload: >- | ||
{ | ||
"tag": "${{ steps.get-tag.outputs.tag }}-${{ steps.get-short.outputs.sha_short }}" | ||
} |