From f3090ecc04e2d8a0ac2dc64417ed41c142a6c26f Mon Sep 17 00:00:00 2001 From: Adam Tilghman Date: Sat, 17 Feb 2024 21:02:15 -0800 Subject: [PATCH] new workflow --- .github/workflows/code-analysis.yml | 47 ------------------ .github/workflows/docker.chatgpt-lite.yml | 38 --------------- .github/workflows/docker.yml | 59 +++++++++++++++++++++++ 3 files changed, 59 insertions(+), 85 deletions(-) delete mode 100644 .github/workflows/code-analysis.yml delete mode 100644 .github/workflows/docker.chatgpt-lite.yml create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml deleted file mode 100644 index b7069f2..0000000 --- a/.github/workflows/code-analysis.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Lint -on: - push: - branches: - - main - pull_request: {} - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - lint: - name: ESLint - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Download deps - uses: bahmutov/npm-install@v1 - - - name: Lint - run: npm run lint - - prettier: - name: Prettier - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Download deps - uses: bahmutov/npm-install@v1 - - - name: Prettier check - run: npm run format:check diff --git a/.github/workflows/docker.chatgpt-lite.yml b/.github/workflows/docker.chatgpt-lite.yml deleted file mode 100644 index b2372b0..0000000 --- a/.github/workflows/docker.chatgpt-lite.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Publish blrchen/chatgpt-lite - -on: - workflow_dispatch: - push: - branches: - - main - -jobs: - build_and_push_image: - name: Push image to Docker Hub - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: blrchen/chatgpt-lite - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..0b4dc74 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,59 @@ +name: Build notebook +on: + push: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout notebook + uses: actions/checkout@v3 + + - name: Log in to registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Generate tags and labels + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Check Free Space 0 + run: | + echo "Free space:" + df -h + + - name: Docker/ENV cleanup Cleanup + run: | + docker image prune -a -f + docker container prune -f + sudo rm -rf /usr/local/lib/android + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + + - name: Check Free Space 1 + run: | + echo "Free space:" + df -h + + - name: Build and push notebook + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}