aboutsummaryrefslogtreecommitdiffstats
path: root/ci/push.yml
blob: 9449df0e2ce063f8b1f6c7e31fca7c958bac74e6 (plain) (blame)
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
steps:
  # Always build this image unless it's for a pull request.
  - script: |
      docker build \
        -f docker/Dockerfile \
        -t pythondiscord/snekbox:latest \
        .
    displayName: 'Build Final Image'
    condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

  # Push images only after they've all successfully been built.
  - script: docker push pythondiscord/snekbox-base:latest
    displayName: 'Push Base Image'
    condition: >
      and(
        succeeded(),
        ne(variables['Build.Reason'], 'PullRequest'),
        ne(variables.BASE_PULL, 'True'),
        or(
          eq(variables.BASE_CHANGED, 'True'),
          eq(variables.VENV_CHANGED, 'True')
        )
      )

  - script: docker push pythondiscord/snekbox-venv:latest
    displayName: 'Push Virtual Environment Image'
    condition: >
      and(
        succeeded(),
        ne(variables['Build.Reason'], 'PullRequest'),
        or(
          eq(variables.BASE_CHANGED, 'True'),
          eq(variables.VENV_CHANGED, 'True')
        )
      )

  - script: docker push pythondiscord/snekbox:latest
    displayName: 'Push Final Image'
    condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))