forked from immortalwrt/docker
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (80 loc) · 2.65 KB
/
imagebuilder.yml
File metadata and controls
93 lines (80 loc) · 2.65 KB
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
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
name: Build ImageBuilder images
on:
workflow_dispatch:
inputs:
branch:
description: "Source branch"
required: true
default: "master"
version:
description: "Release version"
required: true
default: "snapshot"
jobs:
generate_targets:
name: Generate target list
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.list_targets.outputs.targets }}
steps:
- name: Checkout ImmortalWrt source tree
uses: actions/checkout@v3
with:
repository: "immortalwrt/immortalwrt"
ref: ${{ github.event.inputs.branch }}
- name: Generate target list
id: list_targets
run: |
for TARGET in $(perl ./scripts/dump-target-info.pl targets 2>/dev/null | awk '{ print $1 }'); do \
TARGET_LIST="${TARGET_LIST:+$TARGET_LIST,}\"${TARGET/\//-}\""; \
done
JSON_LIST="{\"runner\": [\"ubuntu-latest\"],\"targets\":[$TARGET_LIST]}"
echo "$JSON_LIST" | jq .
echo "::set-output name=targets::$JSON_LIST"
build:
name: Build ImageBuilder image for ${{ matrix.targets }}
needs: generate_targets
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate_targets.outputs.targets)}}
steps:
- name: Checkout docker repo
uses: actions/checkout@v3
- name: Download ImageBuilder for ${{ matrix.targets }}
run: ./download_files.sh ib
env:
TARGET: ${{ matrix.targets }}
VERSION: ${{ github.event.inputs.version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver: docker
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build base image
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile.base
platforms: linux/amd64
push: false
tags: gustavo8000br:base
- name: Build and push ImageBuilder image
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile.ib
platforms: linux/amd64
push: true
tags: |
gustavo8000br/imagebuilder:${{ matrix.targets }}-${{ github.event.inputs.branch }}
gustavo8000br/imagebuilder:${{ matrix.targets }}-${{ github.event.inputs.version }}