Build SDK images (trigger) #22474
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-License-Identifier: GPL-2.0-only | |
# | |
# Copyright (C) 2021 ImmortalWrt.org | |
name: Build SDK images (trigger) | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: "Source branch" | |
required: true | |
default: "master" | |
version: | |
description: "Release version" | |
required: true | |
default: "snapshot" | |
target: | |
description: "Target" | |
required: true | |
arch: | |
description: "Architecture" | |
required: true | |
jobs: | |
build: | |
name: Build SDK image for ${{ github.event.inputs.target }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Free disk spaces | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
docker rmi $(docker images -q) | |
sudo -E apt-get -y purge azure-cli dotnet* firefox ghc* google* llvm* moby* mongodb* openjdk* powershell zulu* | |
sudo -E apt-get -y autoremove --purge | |
sudo -E rm -rf $AGENT_TOOLSDIRECTORY /usr/local/lib/android /usr/share/dotnet | |
- name: Checkout docker repo | |
uses: actions/checkout@v4 | |
- name: Download SDK for ${{ github.event.inputs.target }} | |
run: ./download_files.sh sdk | |
env: | |
TARGET: ${{ github.event.inputs.target }} | |
VERSION: ${{ github.event.inputs.version }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: docker | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build base image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile.base | |
platforms: linux/amd64 | |
push: false | |
tags: immortalwrt:base | |
- name: Build and push SDK image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile.sdk | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
immortalwrt/sdk:${{ github.event.inputs.arch }}-${{ github.event.inputs.branch }} | |
immortalwrt/sdk:${{ github.event.inputs.arch }}-${{ github.event.inputs.version }} | |
immortalwrt/sdk:${{ github.event.inputs.target }}-${{ github.event.inputs.branch }} | |
immortalwrt/sdk:${{ github.event.inputs.target }}-${{ github.event.inputs.version }} | |
- name: Push extra tags for snapshot | |
if: ${{ github.event.inputs.version == 'snapshot' }} | |
run: | | |
docker tag immortalwrt/sdk:${{ github.event.inputs.target }}-${{ github.event.inputs.version }} immortalwrt/sdk:${{ github.event.inputs.arch }} | |
docker tag immortalwrt/sdk:${{ github.event.inputs.target }}-${{ github.event.inputs.version }} immortalwrt/sdk:${{ github.event.inputs.target }} | |
docker push immortalwrt/sdk:${{ github.event.inputs.arch }} | |
docker push immortalwrt/sdk:${{ github.event.inputs.target }} | |
- name: Push extra tags for x86-64 | |
if: ${{ github.event.inputs.target == 'x86-64' }} | |
run: | | |
docker tag immortalwrt/sdk:${{ github.event.inputs.target }}-${{ github.event.inputs.version }} immortalwrt/sdk:${{ github.event.inputs.branch }} | |
docker tag immortalwrt/sdk:${{ github.event.inputs.target }}-${{ github.event.inputs.version }} immortalwrt/sdk:${{ github.event.inputs.version }} | |
docker push immortalwrt/sdk:${{ github.event.inputs.branch }} | |
docker push immortalwrt/sdk:${{ github.event.inputs.version }} |