Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
KagChi authored Jun 27, 2024
1 parent b427dc2 commit f71bde7
Showing 1 changed file with 16 additions and 48 deletions.
64 changes: 16 additions & 48 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,18 @@
name: Build Docker Images
on: [push]
name: Build & Push to container registry

on:
release:
types: [created]
push:
branches:
- main
pull_request:
branches:
- "**"
paths:
- "Dockerfile"

jobs:
build-docker-image:
strategy:
matrix:
target-cpu: ["aarch64"]

name: Build for ${{ matrix.target-cpu }}
env:
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_TARGET_ACCOUNT: ${{ secrets.DOCKERHUB_TARGET }}

runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Login to DockerHub
uses: docker/login-action@v2
if: env.DOCKER_USERNAME
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Login to ghcr
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Convert GITHUB_REPOSITORY into lowercase
run: |
echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Build Docker Image
run: |
docker build -t gateway-proxy:${{ matrix.target-cpu }} --build-arg TARGET_CPU=${{ matrix.target-cpu }}.
- name: Create manifest and push it
if: env.DOCKER_USERNAME && github.ref == 'refs/heads/main'
run: |
docker tag gateway-proxy:${{ matrix.target-cpu }} ${{ secrets.DOCKERHUB_TARGET }}/gateway-proxy:${{ matrix.target-cpu }}
docker push ${{ secrets.DOCKERHUB_TARGET }}/gateway-proxy:${{ matrix.target-cpu }}
docker tag gateway-proxy:${{ matrix.target-cpu }} ghcr.io/${REPO}:${{ matrix.target-cpu }}
docker push ghcr.io/${REPO}:${{ matrix.target-cpu }}
docker:
uses: nezuchan/workflows/.github/workflows/docker-build.yml@main
secrets: inherit

0 comments on commit f71bde7

Please sign in to comment.