aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/autogpt-docker-cache-clean.yml
blob: 780caf44f9c07525d20c5569d7c47581ab40350c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Purge Auto-GPT Docker CI cache

on:
  schedule:
    - cron: 20 4 * * 1,4

env:
  BASE_BRANCH: development
  IMAGE_NAME: auto-gpt

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        build-type: [release, dev]
    steps:
    - name: Checkout repository
      uses: actions/checkout@v3

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v2

    - id: build
      name: Build image
      uses: docker/build-push-action@v3
      with:
        context: autogpts/autogpt
        build-args: BUILD_TYPE=${{ matrix.build-type }}
        load: true    # save to docker images
        # use GHA cache as read-only
        cache-to: type=gha,scope=autogpt-docker-${{ matrix.build-type }},mode=max

    - name: Generate build report
      env:
        event_name: ${{ github.event_name }}
        event_ref: ${{ github.event.schedule }}

        build_type: ${{ matrix.build-type }}

        prod_branch: master
        dev_branch: development
        repository: ${{ github.repository }}
        base_branch: ${{ github.ref_name != 'master' && github.ref_name != 'development' && 'development' || 'master' }}

        current_ref: ${{ github.ref_name }}
        commit_hash: ${{ github.sha }}
        source_url: ${{ format('{0}/tree/{1}', github.event.repository.url, github.sha) }}
        push_forced_label:

        new_commits_json: ${{ null }}
        compare_url_template: ${{ format('/{0}/compare/{{base}}...{{head}}', github.repository) }}

        github_context_json: ${{ toJSON(github) }}
        job_env_json: ${{ toJSON(env) }}
        vars_json: ${{ toJSON(vars) }}

      run: .github/workflows/scripts/docker-ci-summary.sh >> $GITHUB_STEP_SUMMARY
      continue-on-error: true