Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: docker build & push #250

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -32,3 +32,37 @@ jobs:
env:
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}

publish-docker:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install secator
uses: ./.github/actions/install
with:
python-version: ${{ matrix.python-version }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Docker image
run: secator u build docker

- name: Publish Docker image
run: secator u publish docker


26 changes: 14 additions & 12 deletions secator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,17 +840,18 @@ def record(record_name, script, interactive, width, height, output_dir):
@utils.group('build')
def build():
"""Build secator."""
if not DEV_PACKAGE:
console.print('[bold red]You MUST use a development version of secator to make builds.[/]')
sys.exit(1)
if not BUILD_ADDON_ENABLED:
console.print('[bold red]Missing dev addon: please run `secator install addons dev`')
sys.exit(1)
pass


@build.command('pypi')
def build_pypi():
"""Build secator PyPI package."""
if not DEV_PACKAGE:
console.print('[bold red]You MUST use a development version of secator to make builds.[/]')
sys.exit(1)
if not BUILD_ADDON_ENABLED:
console.print('[bold red]Missing build addon: please run `secator install addons build`')
sys.exit(1)
with console.status('[bold gold3]Building PyPI package...[/]'):
ret = Command.execute(f'{sys.executable} -m hatch build', name='hatch build', cwd=ROOT_FOLDER)
sys.exit(ret.return_code)
Expand All @@ -869,17 +870,18 @@ def build_docker(dev):
@utils.group('publish')
def publish():
"""Publish secator."""
if not DEV_PACKAGE:
console.print('[bold red]You MUST use a development version of secator to make releases.[/]')
sys.exit(1)
if not BUILD_ADDON_ENABLED:
console.print('[bold red]Missing dev addon: please run `secator install addons dev`')
sys.exit(1)
pass


@publish.command('pypi')
def publish_pypi():
"""Publish secator PyPI package."""
if not DEV_PACKAGE:
console.print('[bold red]You MUST use a development version of secator to make builds.[/]')
sys.exit(1)
if not BUILD_ADDON_ENABLED:
console.print('[bold red]Missing build addon: please run `secator install addons build`')
sys.exit(1)
os.environ['HATCH_INDEX_USER'] = '__token__'
hatch_token = os.environ.get('HATCH_INDEX_AUTH')
if not hatch_token:
Expand Down
Loading