update README #1
Workflow file for this run
This file contains hidden or 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: Backend CI | |
on: | |
pull_request: | |
types: | |
- closed | |
paths: | |
- 'backend/**' | |
workflow_dispatch: | |
jobs: | |
Docker-Buildx: | |
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- | |
name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Set up Git Actions | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git config --global pull.rebase true | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./backend | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/shodapp-k8s-backend:${{ github.run_id }} | |
${{ secrets.DOCKERHUB_USERNAME }}/shodapp-k8s-backend:latest | |
- name: Update kubernetes manifests | |
run: | | |
git pull origin main | |
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
sed -i "s|kubectl.kubernetes.io/restartedAt: '.*'|kubectl.kubernetes.io/restartedAt: '$timestamp'|" k8s/backend/backend-deployment.yml | |
git add k8s/backend/backend-deployment.yml | |
git commit -m "Update backend deployment timestamp for new image" || echo "No changes to commit" | |
git push origin main |