-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (92 loc) · 2.82 KB
/
release.yml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
name: Release
'on':
pull_request:
push:
branches:
- main
schedule:
- cron: "0 7 * * 0"
env:
IMAGE_NAME: fixbuf
jobs:
# Test the image builds and works correctly.
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v4
- name: Set up Python 3.
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install test dependencies.
run: pip3 install pytest-testinfra
- name: Build image.
run: docker build -t cmusei/${{ env.IMAGE_NAME }} .
- name: Run the built image.
run: docker run --name=${{ env.IMAGE_NAME }} -td cmusei/${{ env.IMAGE_NAME }}
- name: Test the built image.
run: py.test --hosts='docker://${{ env.IMAGE_NAME }}'
# If on main branch, build and release image.
release2:
name: Release2
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image.
uses: docker/build-push-action@v6
with:
context: ./
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
cmusei/${{ env.IMAGE_NAME }}:latest
cmusei/${{ env.IMAGE_NAME }}:2
cmusei/${{ env.IMAGE_NAME }}:2.5.0
ghcr.io/cmusei/${{ env.IMAGE_NAME }}:latest
ghcr.io/cmusei/${{ env.IMAGE_NAME }}:2
ghcr.io/cmusei/${{ env.IMAGE_NAME }}:2.5.0
release3:
name: Release3
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push image.
uses: docker/build-push-action@v6
with:
context: ./
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
FIXBUF_VERSION=3.0.0.alpha2
tags: |
cmusei/${{ env.IMAGE_NAME }}:3
ghcr.io/cmusei/${{ env.IMAGE_NAME }}:3