diff --git a/.github/workflows/ci_docker.yml b/.github/workflows/ci_docker.yml index 2bf4c7e..cd00d75 100644 --- a/.github/workflows/ci_docker.yml +++ b/.github/workflows/ci_docker.yml @@ -174,3 +174,79 @@ jobs: with: name: alpine_digests path: digests.txt + + build-and-push-docker-buster-image: + name: Build Docker Buster image (for PyInstsaller) and push to repositories + # run only when code is compiling and tests are passing + runs-on: ubuntu-latest + + # steps to perform in job + steps: + - name: Checkout code + uses: actions/checkout@v3 + + # avoid building if there are testing errors + - name: Run smoke test + run: | + sudo apt-get install -y libzbar0 + python -m pip install --upgrade pip + pip install -U -r requirements-dev.txt + pip install -U . + pytest + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + # setup Docker build action + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + # Workaround for failing builds: https://github.com/docker/build-push-action/issues/761#issuecomment-1383822381 + # TODO remove workaround when fixed + with: + driver-opts: | + image=moby/buildkit:v0.10.6 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to Github Packages + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GHCR_IO_TOKEN }} + + - name: "Build image from Buster and push to GitHub Container Registry" + id: docker_build_buster + if: github.ref == 'refs/heads/master' + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64,linux/arm64 + # relative path to the place where source code with Dockerfile is located + # TODO file:, move to docker/ + context: . + file: Dockerfile + # builder: ${{ steps.buildx.outputs.name }} + build-args: | + BASE_IMAGE=python:3.11-slim-buster + # Note: tags has to be all lower-case + pull: true + tags: | + scit0/extract_otp_secrets:buster + push: true + + - name: Image digest + # TODO upload digests to assets + run: | + echo "extract_otp_secrets digests: ${{ steps.docker_build_qr_reader_latest.outputs.digest }}" + echo "${{ steps.docker_build_qr_reader_latest.outputs.digest }}" > digests.txt + - name: Save docker digests as artifacts + if: github.ref == 'refs/heads/master' + uses: actions/upload-artifact@v3 + with: + name: buster_digests + path: digests.txt diff --git a/.github/workflows/ci_release.yml b/.github/workflows/ci_release.yml index 0e117e2..f0104cf 100644 --- a/.github/workflows/ci_release.yml +++ b/.github/workflows/ci_release.yml @@ -37,7 +37,7 @@ on: pull_request: schedule: # Run weekly on default branch - - cron: '47 3 * * 6' + - cron: '47 4 * * 6' jobs: @@ -131,6 +131,8 @@ jobs: - name: "Build image from Buster and push to GitHub Container Registry" id: docker_build_buster + # Disable and build in ci_docker for speeding up releases + if: false uses: docker/build-push-action@v3 with: platforms: linux/amd64,linux/arm64 @@ -340,7 +342,7 @@ jobs: -H "X-GitHub-Api-Version: 2022-11-28" \ --silent \ --show-error \ - https://api.github.com/repos/scito/extract_otp_secrets/releases/90604736/assets | + https://api.github.com/repos/scito/extract_otp_secrets/releases/${{ steps.meta.outputs.release_id }}/assets | jq -r '.[].url'); do echo "Download $asset_url" name=$(curl \