Skip to content

add trigger for gha #20

add trigger for gha

add trigger for gha #20

name: Build Docker Container
on:
push:
branches:
- main
workflow_dispatch:
jobs:
generate-requirements-txt:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: install poetry
run: python3 -m pip install poetry
- name: install poetry dependencies
run: poetry install
- name: export requirements.txt
run: poetry export --without-hashes -f requirements.txt --output requirements.txt
- name: upload requirements.txt
uses: actions/upload-artifact@v4
with:
name: requirements
path: requirements.txt
build-and-publish-amd64:
runs-on: ubuntu-latest
needs: generate-requirements-txt
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Download requirements.txt
uses: actions/download-artifact@v4
with:
name: requirements
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build amd64 image
run: docker build -t ghcr.io/felix920506/jellychord:latest-amd64 --platform linux/amd64 .
- name: push amd64 image
run: docker push ghcr.io/felix920506/jellychord:latest-amd64
build-and-publish-arm64:
runs-on: ubuntu-24.04-arm
needs: generate-requirements-txt
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Download requirements.txt
uses: actions/download-artifact@v4
with:
name: requirements
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build arm64 image
run: docker build -t ghcr.io/felix920506/jellychord:latest-arm64 --platform linux/arm64 .
- name: push arm64 image
run: docker push ghcr.io/felix920506/jellychord:latest-arm64
generate-manifest:
runs-on: ubuntu-latest
needs: [build-and-publish-arm64, build-and-publish-amd64]
steps:
- name: setup docker buildx
uses: docker/setup-buildx-action@v3
- name: Log in to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push manifest images
uses: Noelware/docker-manifest-action@master
with:
inputs: ghcr.io/felix920506/jellychord:latest
images: ghcr.io/felix920506/jellychord:latest-amd64,ghcr.io/felix920506/jellychord:latest-arm64
push: true