CI: WIP
This commit is contained in:
parent
9f7b090273
commit
821df02758
1 changed files with 11 additions and 21 deletions
|
@ -28,33 +28,23 @@ jobs:
|
||||||
run: .venv/bin/pytest -s tests/basic.py
|
run: .venv/bin/pytest -s tests/basic.py
|
||||||
|
|
||||||
- name: Get version
|
- name: Get version
|
||||||
run: echo "VERSION=$(.venv/bin/dunamai from any --style semver)" >> $GITHUB_ENV
|
run: |
|
||||||
|
echo "VERSION=$(.venv/bin/dunamai from any --style semver)" >> $GITHUB_ENV
|
||||||
- name: Version
|
echo $VERSION
|
||||||
run: echo $VERSION
|
|
||||||
|
|
||||||
- name: Get distance from tag
|
- name: Get distance from tag
|
||||||
run: echo "DISTANCE=$(.venv/bin/dunamai from any --format '{distance}')" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Distance
|
|
||||||
run: echo $DISTANCE
|
|
||||||
|
|
||||||
- name: Check if the container should be built (distance from git tag is 0, or force build)
|
|
||||||
id: builder
|
|
||||||
env:
|
|
||||||
RUN: ${{ toJSON(inputs.build || env.DISTANCE == "0") }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "run=$RUN" >> $GITHUB_OUTPUT
|
echo "DISTANCE=$(.venv/bin/dunamai from any --format '{distance}')" >> $GITHUB_ENV
|
||||||
echo "Run build: $RUN"
|
echo $DISTANCE
|
||||||
|
|
||||||
- name: Workaround for bug of podman-login
|
- name: Workaround for bug of podman-login
|
||||||
if: fromJSON(steps.builder.outputs.run)
|
if: env.DISTANCE == '0'
|
||||||
run: |
|
run: |
|
||||||
mkdir -p $HOME/.docker
|
mkdir -p $HOME/.docker
|
||||||
echo "{ \"auths\": {} }" > $HOME/.docker/config.json
|
echo "{ \"auths\": {} }" > $HOME/.docker/config.json
|
||||||
|
|
||||||
- name: Log in to the container registry (with another workaround)
|
- name: Log in to the container registry (with another workaround)
|
||||||
if: fromJSON(steps.builder.outputs.run)
|
if: env.DISTANCE == '0'
|
||||||
uses: actions/podman-login@v1
|
uses: actions/podman-login@v1
|
||||||
with:
|
with:
|
||||||
registry: ${{ vars.REGISTRY }}
|
registry: ${{ vars.REGISTRY }}
|
||||||
|
@ -63,7 +53,7 @@ jobs:
|
||||||
auth_file_path: /tmp/auth.json
|
auth_file_path: /tmp/auth.json
|
||||||
|
|
||||||
- name: Build the container image
|
- name: Build the container image
|
||||||
if: fromJSON(steps.builder.outputs.run)
|
if: env.DISTANCE == '0'
|
||||||
uses: actions/buildah-build@v1
|
uses: actions/buildah-build@v1
|
||||||
with:
|
with:
|
||||||
image: oidc-fastapi-test
|
image: oidc-fastapi-test
|
||||||
|
@ -74,7 +64,7 @@ jobs:
|
||||||
./Containerfile
|
./Containerfile
|
||||||
|
|
||||||
- name: Push the image to the registry
|
- name: Push the image to the registry
|
||||||
if: fromJSON(steps.builder.outputs.run)
|
if: env.DISTANCE == '0'
|
||||||
uses: actions/push-to-registry@v2
|
uses: actions/push-to-registry@v2
|
||||||
with:
|
with:
|
||||||
registry: "docker://${{ vars.REGISTRY }}/${{ vars.ORGANISATION }}"
|
registry: "docker://${{ vars.REGISTRY }}/${{ vars.ORGANISATION }}"
|
||||||
|
@ -82,11 +72,11 @@ jobs:
|
||||||
tags: latest ${{ steps.version.outputs.version }}
|
tags: latest ${{ steps.version.outputs.version }}
|
||||||
|
|
||||||
- name: Build wheel
|
- name: Build wheel
|
||||||
if: fromJSON(steps.builder.outputs.run)
|
if: env.DISTANCE == '0'
|
||||||
run: uv build --wheel
|
run: uv build --wheel
|
||||||
|
|
||||||
- name: Publish Python package (home)
|
- name: Publish Python package (home)
|
||||||
if: fromJSON(steps.builder.outputs.run)
|
if: env.DISTANCE == '0'
|
||||||
env:
|
env:
|
||||||
LOCAL_PYPI_TOKEN: ${{ secrets.LOCAL_PYPI_TOKEN }}
|
LOCAL_PYPI_TOKEN: ${{ secrets.LOCAL_PYPI_TOKEN }}
|
||||||
run: uv publish --publish-url https://code.philo.ydns.eu/api/packages/philorg/pypi --token $LOCAL_PYPI_TOKEN
|
run: uv publish --publish-url https://code.philo.ydns.eu/api/packages/philorg/pypi --token $LOCAL_PYPI_TOKEN
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue