2024-09-20 01:04:01 -06:00
|
|
|
name: Build and Push Docker Image
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [main]
|
|
|
|
pull_request:
|
|
|
|
branches: [main]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-push:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Build the Docker image
|
|
|
|
run: docker build . --file Dockerfile --tag atridad:${{ github.sha }}
|
|
|
|
|
|
|
|
- name: Install doctl
|
|
|
|
uses: digitalocean/action-doctl@v2
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
|
|
|
|
|
|
|
- name: Log in to DO Container Registry
|
|
|
|
run: doctl registry login --expiry-seconds 600
|
|
|
|
|
2024-09-20 01:31:33 -06:00
|
|
|
- name: Tag images
|
|
|
|
run: |
|
2024-09-20 21:29:30 -06:00
|
|
|
docker tag atridad:${{ github.sha }} ${{ secrets.DIGITALOCEAN_REGISTRY }}:${{ github.sha }}
|
|
|
|
docker tag atridad:${{ github.sha }} ${{ secrets.DIGITALOCEAN_REGISTRY }}:latest
|
2024-09-20 01:04:01 -06:00
|
|
|
|
2024-09-20 01:31:33 -06:00
|
|
|
- name: Push images to DO Container Registry
|
|
|
|
run: |
|
2024-09-20 21:29:30 -06:00
|
|
|
docker push ${{ secrets.DIGITALOCEAN_REGISTRY }}:${{ github.sha }}
|
|
|
|
docker push ${{ secrets.DIGITALOCEAN_REGISTRY }}:latest
|