feature: add dd_version to all image builds #75
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
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/react-frontend.yml" | |
- ".github/scripts/auth.sh" | |
- ".github/scripts/deploy.sh" | |
- "react-frontend/*" | |
- "react-frontend/*/*" | |
- "react-frontend/*/*/*" | |
- "react-frontend/*/*/*/*" | |
- "react-frontend/*/*/*/*/*" | |
name: Cloud Game React Frontend | |
jobs: | |
build-frontend: | |
name: Build React Frontend | |
runs-on: ubuntu-latest | |
env: | |
IMAGE: cloudgame/frontend | |
steps: | |
- uses: actions/checkout@master | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Docker Container | |
run: | | |
cd react-frontend | |
docker build -t $IMAGE:$GITHUB_RUN_ID -f Dockerfile --build-arg API_URL=${API_URL} --build-arg DD_GIT_REPOSITORY_URL=$(git config --get remote.origin.url) --build-arg DD_GIT_COMMIT_SHA=${{ github.sha }} . | |
env: | |
API_URL: https://api.cloud-game.app | |
- name: Push Container | |
run: | | |
docker tag $IMAGE:$GITHUB_RUN_ID $IMAGE:latest | |
docker push $IMAGE:$GITHUB_RUN_ID | |
docker push $IMAGE:latest | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: | |
- build-frontend | |
steps: | |
- uses: actions/checkout@master | |
- name: Deploy to Server | |
env: | |
DEPLOY_SSH_PRIV_KEY: ${{ secrets.DEPLOY_SSH_PRIV_KEY }} | |
run: ./.github/scripts/deploy.sh |