Initial commit #1
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: Update RunPod Template | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
update-template: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Authenticate with Docker Registry | |
run: | | |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
- name: Fetch latest Docker image | |
run: | | |
IMAGE_TAG=$(docker pull my-image:latest | grep 'Digest:' | awk '{print $2}') | |
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV | |
- name: Update RunPod template | |
run: | | |
curl -X POST "https://api.runpod.io/v1/template" \ | |
-H "Authorization: Bearer ${{ secrets.RUNPOD_API_KEY }}" \ | |
-H "Content-Type: application/json" \ | |
-d '{ | |
"templateId": "ti08xt5xpn", | |
"container": { | |
"image": "my-image:${IMAGE_TAG}" | |
} | |
}' |