Build and Push #756
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
name: Build and Push | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 6 * * *' | |
env: | |
IMAGE_NAME: menci/archlinuxarm | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- tag: base | |
package-group: base | |
- tag: base-devel | |
package-group: base base-devel | |
name: ${{ matrix.target.tag }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate Tag List | |
run: | | |
echo "TAGS<<EOF" >> $GITHUB_ENV | |
DATE="$(date +'%Y%m%d')" | |
for REGISTRY in {"","ghcr.io/"}; do | |
echo $REGISTRY$IMAGE_NAME:$TAG >> $GITHUB_ENV | |
echo $REGISTRY$IMAGE_NAME:$TAG-$DATE.$RUN_ID >> $GITHUB_ENV | |
if [[ "$TAG" == "base" ]]; then | |
echo $REGISTRY$IMAGE_NAME:latest >> $GITHUB_ENV | |
fi | |
done | |
echo "EOF" >> $GITHUB_ENV | |
env: | |
TAG: ${{ matrix.target.tag }} | |
RUN_ID: ${{ github.run_id }} | |
- name: Build and Push | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/riscv64 | |
push: true | |
tags: ${{ env.TAGS }} | |
build-args: | | |
PACKAGE_GROUP=${{ matrix.target.package-group }} |