PluralKit/.github/workflows/api.yml
2023-02-15 19:27:36 -05:00

37 lines
1.0 KiB
YAML

name: Build and push API Docker image
on:
push:
branches:
- main
- 'rust-api'
paths:
- 'lib/pklib/**'
- 'services/api/**'
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
packages: write
if: github.repository == 'PluralKit/PluralKit'
steps:
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
- uses: actions/checkout@v2
- run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- uses: docker/build-push-action@v2
with:
# https://github.com/docker/build-push-action/issues/378
context: .
file: services/api/Dockerfile
push: true
tags: |
ghcr.io/pluralkit/api:${{ env.BRANCH_NAME }}
ghcr.io/pluralkit/api:${{ github.sha }}
ghcr.io/pluralkit/api:latest
cache-from: type=registry,ref=ghcr.io/pluralkit/pluralkit:${{ env.BRANCH_NAME }}
cache-to: type=inline