Build rootfs images (trigger) #1770
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 rootfs 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 rootfs 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 rootfs for ${{ github.event.inputs.target }} | |
run: ./download_files.sh rootfs | |
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 and push rootfs image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile.rootfs | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
immortalwrt/rootfs:${{ github.event.inputs.arch }}-${{ github.event.inputs.branch }} | |
immortalwrt/rootfs:${{ github.event.inputs.arch }}-${{ github.event.inputs.version }} | |
immortalwrt/rootfs:${{ github.event.inputs.target }}-${{ github.event.inputs.branch }} | |
immortalwrt/rootfs:${{ github.event.inputs.target }}-${{ github.event.inputs.version }} | |
- name: Push extra tags for snapshot | |
if: ${{ github.event.inputs.version == 'snapshot' }} | |
run: | | |
docker tag immortalwrt/rootfs:${{ github.event.inputs.target }}-${{ github.event.inputs.version }} immortalwrt/rootfs:${{ github.event.inputs.arch }} | |
docker tag immortalwrt/rootfs:${{ github.event.inputs.target }}-${{ github.event.inputs.version }} immortalwrt/rootfs:${{ github.event.inputs.target }} | |
docker push immortalwrt/rootfs:${{ github.event.inputs.arch }} | |
docker push immortalwrt/rootfs:${{ github.event.inputs.target }} | |
- name: Push extra tags for x86-64 | |
if: ${{ github.event.inputs.target == 'x86-64' }} | |
run: | | |
docker tag immortalwrt/rootfs:${{ github.event.inputs.target }}-${{ github.event.inputs.version }} immortalwrt/rootfs:${{ github.event.inputs.branch }} | |
docker tag immortalwrt/rootfs:${{ github.event.inputs.target }}-${{ github.event.inputs.version }} immortalwrt/rootfs:${{ github.event.inputs.version }} | |
docker push immortalwrt/rootfs:${{ github.event.inputs.branch }} | |
docker push immortalwrt/rootfs:${{ github.event.inputs.version }} |