chore(deps): update all non-major dependencies #243
This file contains hidden or 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: ananta Image CI | |
| permissions: {} | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| paths: | |
| - '.github/workflows/ananta.yml' | |
| - 'script/dummy_ananta.sh' | |
| - 'sshconfig_to_ananta/**' | |
| - 'tests/**' | |
| - '.ananta_version' | |
| - '.dockerignore' | |
| - 'docker-entrypoint.sh' | |
| - 'Dockerfile' | |
| - 'pdm.lock' | |
| - 'pyproject.toml' | |
| pull_request: | |
| paths: | |
| - '.github/workflows/ananta.yml' | |
| - 'script/dummy_ananta.sh' | |
| - 'sshconfig_to_ananta/**' | |
| - 'tests/**' | |
| - '.ananta_version' | |
| - '.dockerignore' | |
| - 'docker-entrypoint.sh' | |
| - 'Dockerfile' | |
| - 'pdm.lock' | |
| - 'pyproject.toml' | |
| schedule: | |
| - cron: "0 5 1-31/10 * *" | |
| workflow_dispatch: | |
| env: | |
| ananta_repo: ${{ secrets.DOCKERHUB_USERNAME }}/ananta | |
| variant: latest | |
| jobs: | |
| ananta: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - | |
| name: Set up QEMU | |
| uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 | |
| - | |
| name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 | |
| - | |
| name: Login to Docker Hub | |
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Chores (generate envs & assets) | |
| id: chores | |
| env: | |
| CACHED_GITHUB_API: ${{ secrets.GH_API_BASEURL }} | |
| run: | | |
| set -e -o pipefail | |
| ver_anata_helper=$(yq -r '.project.version' pyproject.toml | tr -d '\r\n\t\f\v ') | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| echo "variant=dev" >> "$GITHUB_ENV" | |
| ver_anata_helper='dev' | |
| fi | |
| if [[ ! -s .ananta_version ]]; then | |
| echo "ERROR: .ananta_version file not found or is empty" | |
| exit 1 | |
| fi | |
| ver_ananta=$(tr -d '\r\n\t\f\v ' < .ananta_version) | |
| ver_anata_helper="v${ver_anata_helper}-${ver_ananta}" | |
| echo "ver_anata_helper=${ver_anata_helper}" >> "$GITHUB_OUTPUT" | |
| echo "ver_ananta=${ver_ananta}" >> "$GITHUB_OUTPUT" | |
| mkdir -p assets | |
| sed -e "s/REPLACE_ME_ANATA_NO_MINATO_VERSION/${ver_anata_helper}/" \ | |
| script/dummy_ananta.sh \ | |
| > assets/ananta | |
| chmod +x assets/ananta | |
| - name: Build and load the latest variant to local daemon | |
| uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 | |
| with: | |
| build-args: | | |
| ver_anata_helper=${{ steps.chores.outputs.ver_anata_helper }} | |
| ver_ananta=${{ steps.chores.outputs.ver_ananta }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| load: true | |
| tags: | | |
| ${{ env.ananta_repo }}:${{ env.variant }} | |
| ${{ env.ananta_repo }}:${{ steps.chores.outputs.ver_anata_helper }} | |
| - name: Smoke Test | |
| env: | |
| ananta_repo: ${{ env.ananta_repo }} | |
| ver_anata_helper: ${{ steps.chores.outputs.ver_anata_helper }} | |
| run: | | |
| sudo apt-get update -qq \ | |
| && sudo apt-get -y install \ | |
| openssh-client openssh-server \ | |
| && sudo systemctl start ssh.service | |
| mkdir -p "${HOME}/.ssh/" | |
| ssh-keygen -t ed25519 -N '' -f "${HOME}/.ssh/ed25519" | |
| cat "${HOME}/.ssh/ed25519.pub" >> "${HOME}/.ssh/authorized_keys" | |
| cat << EEOOFF > "${HOME}/.ssh/config" | |
| Host testServer | |
| Hostname 127.0.0.1 | |
| User $(whoami) | |
| IdentityFile ${HOME}/.ssh/ed25519 | |
| EEOOFF | |
| #1: no hosts file; ananta arguments specified | |
| bash -x assets/ananta --run-in-ci --no-color whoami \ | |
| | tee /tmp/smoke-test.log | |
| if ! grep -qE '\[testServer\]\s+runner' /tmp/smoke-test.log; then | |
| echo "ERROR: Smoke test #1 failed" | |
| exit 1 | |
| fi | |
| #2: no hosts file; no ananta arguments | |
| bash -x assets/ananta --run-in-ci whoami \ | |
| | tee /tmp/smoke-test.log | |
| if ! grep -qF 'runner' /tmp/smoke-test.log; then | |
| echo "ERROR: Smoke test #2 failed" | |
| exit 1 | |
| fi | |
| docker save -o "ananta.${ver_anata_helper}.tar" "${ananta_repo}:${ver_anata_helper}" | |
| - | |
| name: Build and push | |
| uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 | |
| if: github.event.repository.default_branch == github.ref_name | |
| with: | |
| build-args: | | |
| ver_anata_helper=${{ steps.chores.outputs.ver_anata_helper }} | |
| ver_ananta=${{ steps.chores.outputs.ver_ananta }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| context: '.' | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: | | |
| ${{ env.ananta_repo }}:${{ env.variant }} | |
| ${{ env.ananta_repo }}:${{ steps.chores.outputs.ver_anata_helper }} | |
| - | |
| name: Release | |
| uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0 | |
| if: github.event_name == 'push' && github.event.repository.default_branch == github.ref_name | |
| with: | |
| fail_on_unmatched_files: true | |
| generate_release_notes: true | |
| make_latest: true | |
| tag_name: ${{ steps.chores.outputs.ver_anata_helper }} | |
| files: assets/ananta | |
| - | |
| name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@c1824fd6edce30d7ab345a9989de00bbd46ef284 # 0.34.0 | |
| with: | |
| input: "ananta.${{ steps.chores.outputs.ver_anata_helper }}.tar" | |
| format: 'table' |