ci: add workflow_dispatch to publish #13
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: Build Package | |
env: | |
GIT_SSH_KEY: ${{ secrets.GIT_SSH_KEY }} | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# - name: Setup SSH Agent | |
# uses: webfactory/[email protected] | |
# with: | |
# ssh-private-key: ${{ secrets.GIT_SSH_KEY }} | |
# | |
# - name: Clone Required Repos | |
# run: git clone [email protected]:TetraVeda/kaslcred.git | |
- name: Resolve Version | |
run: | | |
IMAGE_VERSION=$(git describe --tags --abbrev=0) | |
echo "IMAGE_VERSION=$IMAGE_VERSION" >> $GITHUB_ENV | |
echo "building version $IMAGE_VERSION" | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Cache pipenv dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.local/share/virtualenvs | |
~/.cache/pipenv | |
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pipenv- | |
- name: Install pipenv | |
run: | | |
python -m pip install pipenv | |
- name: Install dependencies | |
run: | | |
PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy --ignore-pipfile --dev | |
- name: Run tests | |
run: pipenv run python -m pytest | |
- name: Build | |
run: pipenv run python -m build | |
- name: Archive package artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-package | |
path: dist/* |