Merge pull request #1581 from atsign-foundation/dependabot/docker/too… #59
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: at_root deploy (dev) | |
on: | |
push: | |
branches: | |
- trunk | |
paths: | |
- packages/*_root_server/** | |
permissions: # added using https://github.com/step-security/secure-workflows | |
contents: read | |
jobs: | |
Docker_Build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
# Extract branch for docker tag | |
- name: Get branch name | |
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
- name: Login to DockerHub | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Build the Docker image for Dev | |
- name: Build and push | |
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 | |
with: | |
file: packages/at_root_server/Dockerfile | |
context: packages/at_root_server | |
push: true | |
tags: | | |
atsigncompany/root:dev_env | |
atsigncompany/root:dev_env-${{ env.BRANCH }}-gha${{ github.run_number }} | |
Deploy_On_Dev_K8: | |
needs: Docker_Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
# Extract branch for docker tag | |
- name: Get branch name | |
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
# Setup gcloud CLI | |
- id: 'auth' | |
uses: google-github-actions/auth@35b0e87d162680511bf346c299f71c9c5c379033 # v1.1.1 | |
with: | |
credentials_json: '${{ secrets.GKE_SA_DEV_KEY }}' | |
- name: 'Set up Cloud SDK' | |
uses: google-github-actions/setup-gcloud@e30db14379863a8c79331b04a9969f4c1e225e0b # v1.1.1 | |
# Get the GKE credentials so we can deploy to the cluster | |
- uses: google-github-actions/get-gke-credentials@35ab0d2b2d48792c19f09325413bd185c8d44394 # v1.0.2 | |
with: | |
cluster_name: ${{ secrets.GKE_DEV_CLUSTER }} | |
location: ${{ secrets.GKE_DEV_ZONE }} | |
# Deploy the Docker image to the GKE cluster | |
- name: Deploy | |
run: |- | |
kubectl -n root set image statefulset root root=atsigncompany/root:dev_env |