mirror of
https://github.com/pypa/gh-action-pypi-publish.git
synced 2024-11-24 01:21:05 -05:00
30 lines
757 B
YAML
30 lines
757 B
YAML
|
---
|
||
|
|
||
|
name: 🏗️
|
||
|
|
||
|
on: # yamllint disable-line rule:truthy
|
||
|
pull_request:
|
||
|
push:
|
||
|
branches: ["release/*", "unstable/*"]
|
||
|
tags: ["*"]
|
||
|
|
||
|
jobs:
|
||
|
build-and-push:
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- uses: actions/checkout@v4
|
||
|
- name: Build Docker image
|
||
|
run: |
|
||
|
IMAGE="ghcr.io/$GITHUB_REPOSITORY:${GITHUB_REF_NAME/'/'/'-'}"
|
||
|
echo "IMAGE=$IMAGE" >>"$GITHUB_ENV"
|
||
|
docker build . \
|
||
|
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
||
|
--cache-from $IMAGE \
|
||
|
--tag $IMAGE
|
||
|
- name: Push Docker image to GHCR
|
||
|
if: github.event_name != 'pull_request'
|
||
|
run: |
|
||
|
echo ${{ secrets.GITHUB_TOKEN }} |
|
||
|
docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
|
||
|
docker push $IMAGE
|