mirror of
https://github.com/ep1cman/unifi-protect-backup.git
synced 2025-12-05 23:53:30 +00:00
89 lines
2.3 KiB
YAML
89 lines
2.3 KiB
YAML
# Publish package on main branch if it's tagged with 'v*'
|
|
|
|
name: Release & Publish Workflow
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
release:
|
|
name: Create Release
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Get version from tag
|
|
id: tag_name
|
|
run: |
|
|
echo "current_version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
shell: bash
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Get Changelog Entry
|
|
id: changelog_reader
|
|
uses: mindsers/changelog-reader-action@v2
|
|
with:
|
|
version: ${{ steps.tag_name.outputs.current_version }}
|
|
path: ./CHANGELOG.md
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Install uv
|
|
run: |
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
|
|
- name: Build wheels and source tarball
|
|
run: uv build
|
|
|
|
- name: Show build artifacts
|
|
run: ls -lR dist/
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push container
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
ghcr.io/${{ github.repository }}:${{ steps.tag_name.outputs.current_version }}
|
|
ghcr.io/${{ github.repository }}:latest
|
|
|
|
- name: Create GitHub release
|
|
id: create_release
|
|
uses: softprops/action-gh-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
body: ${{ steps.changelog_reader.outputs.changes }}
|
|
files: dist/*
|
|
draft: false
|
|
prerelease: false
|
|
|
|
- name: Publish to PyPI
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
user: __token__
|
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
skip_existing: true
|