2022-09-20 14:27:41 +00:00
|
|
|
name: Build and push Docker image
|
2021-06-09 10:27:33 +00:00
|
|
|
on:
|
|
|
|
push:
|
2022-09-20 14:27:41 +00:00
|
|
|
paths:
|
|
|
|
- 'Myriad/**'
|
|
|
|
- 'PluralKit.API/**'
|
|
|
|
- 'PluralKit.Bot/**'
|
|
|
|
- 'PluralKit.Core/**'
|
|
|
|
|
2021-06-09 10:27:33 +00:00
|
|
|
jobs:
|
|
|
|
deploy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
packages: write
|
2022-06-05 16:57:10 +00:00
|
|
|
if: github.repository == 'PluralKit/PluralKit'
|
2021-06-09 10:27:33 +00:00
|
|
|
steps:
|
|
|
|
- uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.CR_PAT }}
|
|
|
|
- uses: actions/checkout@v2
|
2023-05-07 04:38:16 +00:00
|
|
|
- run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" | sed 's|/|-|g' >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Extract Docker metadata
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v3
|
|
|
|
with:
|
|
|
|
images: ghcr.io/${{ github.repository }}
|
|
|
|
tags: |
|
|
|
|
type=raw,value=${{ env.BRANCH_NAME }}
|
|
|
|
type=raw,value=${{ github.sha }}
|
|
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
|
|
|
flavor: |
|
|
|
|
latest=false
|
|
|
|
|
2021-06-09 10:27:33 +00:00
|
|
|
- uses: docker/build-push-action@v2
|
|
|
|
with:
|
2021-08-01 19:32:58 +00:00
|
|
|
# https://github.com/docker/build-push-action/issues/378
|
|
|
|
context: .
|
2021-06-09 10:27:33 +00:00
|
|
|
push: true
|
2023-05-07 04:38:16 +00:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
2022-06-05 16:57:10 +00:00
|
|
|
cache-from: type=registry,ref=ghcr.io/pluralkit/pluralkit:${{ env.BRANCH_NAME }}
|
2021-06-09 10:27:33 +00:00
|
|
|
cache-to: type=inline
|