v / .github / workflows / hub_docker_ci.yml
80 lines · 70 sloc · 2.6 KB · 4b29e678e2138ec01dd5f2c9f9dec4cd66a8459e
Raw
1name: hub_docker_ci
2
3### NB: avoid caching things here, since the action is rare (once per week),
4### and the potential benefits are less than the complexity of debugging
5### cache invalidation issues...
6## Trigger on both new release tags, and on weekly tags.
7## Allow for manual override too:
8on:
9 workflow_dispatch:
10 push:
11 tags:
12 - '[0-9].[0-9]+.[0-9]+'
13 - 'weekly.*'
14
15concurrency:
16 group: 'hub_docker_ci-${{ github.ref }}'
17 cancel-in-progress: true
18
19jobs:
20 publish-new-docker-images:
21 strategy:
22 matrix:
23 os: [debian, alpine]
24 runs-on: ubuntu-latest
25 steps:
26 - uses: actions/checkout@v6
27 with:
28 repository: 'vlang/docker'
29
30 - name: Set up QEMU
31 uses: docker/setup-qemu-action@v4
32
33 - name: Set up Docker Buildx
34 uses: docker/setup-buildx-action@v4
35
36 - name: Login to hub.docker.com
37 uses: docker/login-action@v4
38 with:
39 username: ${{ secrets.DOCKER_USERNAME }}
40 password: ${{ secrets.DOCKER_PASSWORD }}
41
42 - name: Create & bootstrap persistent builder
43 run: |
44 docker buildx create --name gh-builder --driver docker-container --use
45 docker buildx inspect --bootstrap
46
47 - name: generate tags conditionally
48 id: gen_tags
49 run: |
50 if [[ "${{ matrix.os }}" == 'debian' ]]; then
51 echo 'TAGS=thevlang/vlang:latest,thevlang/vlang:${{ matrix.os }}' >> "$GITHUB_OUTPUT"
52 else
53 echo 'TAGS=thevlang/vlang:${{ matrix.os }}' >> "$GITHUB_OUTPUT"
54 fi
55
56 - uses: docker/build-push-action@v7
57 name: Build and deploy v image
58 with:
59 builder: gh-builder
60 context: .
61 platforms: linux/amd64,linux/arm64
62 tags: ${{ steps.gen_tags.outputs.TAGS }}
63 file: docker/vlang/Dockerfile.${{ matrix.os }}
64 push: true
65 build-args: 'USER=thevlang'
66 ## cache-from: type=registry,ref=thevlang/vlang:${{ matrix.os }}-buildcache
67 ## cache-to: type=registry,ref=thevlang/vlang:${{ matrix.os }}-buildcache,mode=max
68
69 - uses: docker/build-push-action@v7
70 name: Build and deploy developer build
71 with:
72 builder: gh-builder
73 context: .
74 platforms: linux/amd64,linux/arm64
75 tags: thevlang/vlang:${{ matrix.os }}-dev
76 file: docker/vlang/Dockerfile.${{ matrix.os }}.dev-full
77 push: true
78 build-args: 'USER=thevlang'
79 ## cache-from: type=registry,ref=thevlang/vlang:${{ matrix.os }}-dev-buildcache
80 ## cache-to: type=registry,ref=thevlang/vlang:${{ matrix.os }}-dev-buildcache,mode=max
81