Merge pull request #297 from AllenNeuralDynamics/release-v0.15.1 #2
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: Tag and publish main | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
tag_and_publish: | |
name: Parse version | |
runs-on: ubuntu-latest | |
outputs: | |
pkg_version: ${{ steps.output_version.outputs.pkg_version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get version from file | |
run: | | |
pkg_name=$(grep -P 'version = \{attr = .*\}' pyproject.toml | grep -oP '\w+.__version__') | |
init_file="./src/${pkg_name//.__version__}/__init__.py" | |
pkg_version=$(grep -Po '[0-9]+\.[0-9]+\.[0-9]+' "$init_file") | |
echo "docker_tag=$pkg_version" >> "$GITHUB_ENV" | |
- name: Create git tag | |
run: | | |
git tag "v${{ env.docker_tag }}" | |
- name: Push git tag | |
run: git push origin "v${{ env.docker_tag }}" | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Github Packages | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build image and push to GitHub Container Registry | |
uses: docker/build-push-action@v3 | |
with: | |
# relative path to the place where source code with Dockerfile is located | |
context: . | |
push: true | |
tags: | | |
ghcr.io/allenneuraldynamics/aind-metadata-service:${{ env.docker_tag }} | |
ghcr.io/allenneuraldynamics/aind-metadata-service:latest | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
pip install --upgrade setuptools wheel twine build | |
python -m build | |
twine check dist/* | |
- name: Publish on PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1.5 | |
with: | |
password: ${{ secrets.AIND_PYPI_TOKEN }} |