ci: fix github action #4
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: Build and Deploy to Valyent | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Login to Valyent Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: registry.valyent.cloud | |
username: ${{ github.actor }} | |
password: ${{ secrets.VALYENT_API_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: registry.valyent.cloud/${{ secrets.VALYENT_ORG }}/${{ secrets.VALYENT_APP }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=sha,format=long | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: fastapi | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Install Valyent CLI | |
run: curl -L https://cli.valyent.cloud | sh | |
- name: Authenticate Valyent CLI | |
run: ~/.valyent/bin/valyent login --api-key ${{ secrets.VALYENT_API_KEY }} --organization ${{ secrets.VALYENT_ORG }} | |
- name: Deploy to Valyent | |
run: | | |
~/.valyent/bin/valyent deploy --no-build \ | |
--organization ${{ secrets.VALYENT_ORG }} \ | |
--fleet ${{ secrets.VALYENT_APP }} |