This repository has been archived by the owner on Oct 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
84 lines (83 loc) · 3.13 KB
/
scratch.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
name: Scratch
on:
workflow_dispatch:
inputs:
chinese:
description: "using chinese apt and pip source mirrors(Value: 0, 1)"
required: false
default: "0"
boostrap:
description: "Generate boostrap assignment(Value: 0, 1)"
required: false
default: "0"
target:
description: "OpenWRT Target System(Value: x86, bcm27xx, ...)"
required: false
default: "x86"
subtarget:
description: "OpenWRT Subtarget(Value: 64, bcm2711, ...)"
required: false
default: "64"
onedrive:
description: "upload to onedrive(Value: 0, 1)"
required: false
default: "0"
subsequent:
description: "trigger subsequent workflow after build success(Value: 0, 1)"
required: false
default: "0"
schedule:
- cron: "0 0 1 * *" # every month
jobs:
scratch:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- id: var
run: |-
dateDot=$(date +'%y.%m')
echo $dateDot
echo "::set-output name=dateDot::$dateDot"
- name: Build and push base
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile.base
platforms: linux/amd64
build-args: |
CHINESE_APT_MIRRORS=${{ github.event.inputs.chinese }}
CHINESE_PIP_MIRRORS=${{ github.event.inputs.chinese }}
TARGET=${{ github.event.inputs.target }}
SUBTARGET=${{ github.event.inputs.subtarget }}
# TODO: verify target and subtarget is aliable
push: true
tags: |
elonh/opde:base-${{ github.event.inputs.target }}_${{ github.event.inputs.subtarget }}
# elonh/opde:base-${{steps.var.outputs.dateDot}}
- name: set default docker tag
run: |-
docker pull elonh/opde:base-${{ github.event.inputs.target }}_${{ github.event.inputs.subtarget }}
docker tag elonh/opde:base-${{ github.event.inputs.target }}_${{ github.event.inputs.subtarget }} elonh/opde:base
docker images
- name: push default docker tag
if: ${{ github.event.inputs.target == 'x86' || github.event.inputs.subtarget == '64'}}
run: docker push elonh/opde:base
- name: Invoke Base workflow
if: ${{ github.event.inputs.subsequent == '1' || github.event_name == 'schedule'}}
uses: benc-uk/workflow-dispatch@master
with:
workflow: Base
token: ${{ secrets.PERSONAL_TOKEN }}
inputs: '{ "subsequent": "1", "target": "${{ github.event.inputs.target }}", "subtarget": "${{ github.event.inputs.subtarget }}", "onedrive": "${{ github.event.inputs.onedrive }}", "boostrap": "${{ github.event.inputs.boostrap }}"}'