feat: Add homepage #5
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: Docker Image CI | |
on: | |
push: | |
branches: [ "master" ] | |
release: | |
types: [ "published" ] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ghcr.io/${{ github.repository }} | |
jobs: | |
prepare_build: | |
name: Prepare build | |
runs-on: ubuntu-latest | |
outputs: | |
tag_name: ${{ steps.get_tag_name.outputs.tag_name }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get tag name | |
id: get_tag_name | |
run: echo "tag_name=$(git tag --points-at | grep . || git branch --show-current)" >> $GITHUB_OUTPUT | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
needs: prepare_build | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- file: Dockerfile | |
platforms: linux/arm64 | |
tag-prefix: arm64- | |
- file: Dockerfile | |
platforms: linux/amd64 | |
tag-prefix: | |
- file: Dockerfile | |
platforms: linux/arm/v7 | |
tag-prefix: armv7- | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: downcase IMAGE_NAME | |
run: | | |
echo "IMAGE_NAME=${IMAGE_NAME,,}" >>${GITHUB_ENV} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.IMAGE_NAME }} | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v5 | |
with: | |
file: ${{ matrix.file }} | |
platforms: ${{ matrix.platforms }} | |
context: . | |
labels: ${{ steps.meta.outputs.labels }} | |
push: true | |
tags: | | |
${{ env.IMAGE_NAME }}:latest | |
${{ env.IMAGE_NAME }}:${{ matrix.tag-prefix }}${{ needs.prepare_build.outputs.tag_name }} |