v0.1.3 #37
Workflow file for this run
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: Release | |
on: | |
release: | |
types: [created] | |
env: | |
REGISTRY: ghcr.io | |
BACKEND_IMAGE_NAME: ${{ github.repository }}-backend | |
jobs: | |
build-and-push-docker: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write # needed for PyPI publishing | |
outputs: | |
image_name: ${{ steps.meta-backend.outputs.tags }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Backend | |
id: meta-backend | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Build and push Backend image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile.backend | |
push: true | |
target: production | |
tags: ${{ steps.meta-backend.outputs.tags }} | |
labels: ${{ steps.meta-backend.outputs.labels }} | |
- name: Build Python package | |
run: | | |
# Create dist directory | |
mkdir -p dist | |
# Build package using the container we just built - use first tag | |
DOCKER_TAG=$(echo "${{ steps.meta-backend.outputs.tags }}" | head -n1) | |
docker run --rm -v "$(pwd)/dist:/dist" "$DOCKER_TAG" sh -c "cd /pyspur/backend && uv build && cp dist/* /dist/" | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: dist/ |