Skip to content

Commit

Permalink
pypi publish
Browse files Browse the repository at this point in the history
  • Loading branch information
K20shores committed Apr 9, 2024
1 parent 11bf7a4 commit 81d22d6
Show file tree
Hide file tree
Showing 21 changed files with 30 additions and 45 deletions.
61 changes: 22 additions & 39 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,35 @@
name: Create and publish a Docker image
name: Publish a pypi package

on:
push:
branches: ['release']
tags:
- '*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
release:
types: [created]

jobs:
build-and-push-image:
publish_to_pypi:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive

- 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 the Container repository
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
uses: actions/checkout@v4

- name: Build and push Docker image
uses: docker/build-push-action@v5
- name: Set up Python
uses: actions/setup-python@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
python-version: '3.9'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build and publish package
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
pipx run build
pipx run twine check dist/*
python -m twine upload --repository pypi dist/*
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip' # caching pip dependencies
cache: 'pip'

- run: pip install -r requirements.txt

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["flit_core >=3.2,<4", "musica"]
build-backend = "flit_core.buildapi"

[project]
name = "music_box"
name = "acom_music_box"
authors = [{name = "NCAR/ACOM", email = "[email protected]"}]
readme = "README.md"
license = {file = "LICENSE"}
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
musica
pandas
pytest
pipx
pytest
twine
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_analytical.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from music_box import MusicBox
from acom_music_box import MusicBox

import math

Expand Down
2 changes: 1 addition & 1 deletion tests/test_chapman.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from music_box import MusicBox
from acom_music_box import MusicBox
import csv
import math

Expand Down
2 changes: 1 addition & 1 deletion tests/test_wall_loss.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from music_box import MusicBox
from acom_music_box import MusicBox

import csv
import math
Expand Down

0 comments on commit 81d22d6

Please sign in to comment.