Skip to content

Commit

Permalink
Merge pull request #7 from yakimka/fix-ci
Browse files Browse the repository at this point in the history
Fix CI
  • Loading branch information
yakimka authored Apr 21, 2024
2 parents e529cef + 9517b59 commit 3a7c07a
Showing 1 changed file with 1 addition and 57 deletions.
58 changes: 1 addition & 57 deletions .github/workflows/workflow-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:

- name: Prepare Docker
run: |
docker login "$REGISTRY" -u "$REGISTRY_USERNAME" --password="${REGISTRY_TOKEN}"
docker login "$REGISTRY" -u "$REGISTRY_USERNAME" --password="${REGISTRY_TOKEN}" || true
- name: Pull and spin dev container
run: |
Expand Down Expand Up @@ -137,59 +137,3 @@ jobs:
- name: Build and publish
if: startsWith(github.ref, 'refs/tags/')
run: docker exec poetry poetry publish

release-image:
runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: write
needs: [ check-code ]

steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: built-package-py${{ env.MAIN_PY_VERSION }}
path: dist/

- run: echo "IMAGE_FULL_NAME=$(echo ${REGISTRY}/${REGISTRY_USERNAME}/${PROJECT_NAME})" >> $GITHUB_ENV
- run: echo "VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
- run: echo "SHORT_VERSION=$(echo ${VERSION%.*})" >> $GITHUB_ENV

- name: Prepare Docker
run: |
cp .env.template .env
docker login "$REGISTRY" -u "$REGISTRY_USERNAME" --password="${REGISTRY_TOKEN}"
docker buildx create --use --driver=docker-container
docker --version && docker compose --version
- name: Pull and spin dev container
run: |
docker run -v $(pwd):/code -w /code --rm -d --name=poetry ${POETRY_DOCKER_IMAGE} sleep infinity
- run: echo "PROJECT_VERSION=$(docker exec poetry poetry version --short)" >> $GITHUB_ENV

# https://docs.docker.com/build/cache/backends/gha/
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2

- name: Create tag string
run: echo "TAG_ARGS=-t ${IMAGE_FULL_NAME}:latest" >> $GITHUB_ENV

- name: Add version from git tag
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "TAG_ARGS=${TAGS} -t ${IMAGE_FULL_NAME}:${VERSION} -t ${IMAGE_FULL_NAME}:${SHORT_VERSION}" >> $GITHUB_ENV
- name: Set push flag
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
run: echo "PUSH_FLAG=--push" >> $GITHUB_ENV

- name: Build image
run: >
docker buildx build ${PUSH_FLAG:-}
--build-arg WHEEL=${PROJECT_NAME}-${PROJECT_VERSION}-py3-none-any.whl
--cache-to type=gha,mode=max,scope=$GITHUB_REF_NAME
--cache-from type=gha,scope=$GITHUB_REF_NAME
--platform=linux/arm64,linux/amd64
${TAG_ARGS} .

0 comments on commit 3a7c07a

Please sign in to comment.