Skip to content

Publish Docker image (develop) #3615

Publish Docker image (develop)

Publish Docker image (develop) #3615

name: Publish Docker image (develop)
on:
push:
branches-ignore:
- default
workflow_dispatch:
inputs:
branch:
description: 'Branch to publish docker image of (optional)'
required: false
concurrency: docker-develop
jobs:
push_to_dockerhub:
name: 'Push Docker image to Docker Hub'
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Get branch name
id: get_branch
run: echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT
- name: 'Set up Docker Buildx'
id: buildx
uses: docker/setup-buildx-action@v3.0.0
with:
platforms: linux/amd64,linux/arm64
- name: 'Docker meta'
id: meta
uses: docker/metadata-action@v5
with:
images: srgr0/misskey
- name: 'Log in to Docker Hub'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: 'Build and Push to Docker Hub'
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
push: true
platforms: ${{ steps.buildx.outputs.platforms }}
provenance: false
tags: srgr0/misskey:${{ steps.get_branch.outputs.branch }}
labels: ${{ steps.get_branch.outputs.branch }}
cache-from: type=gha
cache-to: type=gha,mode=max
push_to_ghcr:
name: 'Push Docker image to GitHub Container Repository'
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Get branch name
id: get_branch
run: echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT
- name: 'Set up Docker Buildx'
id: buildx
uses: docker/setup-buildx-action@v3.0.0
with:
platforms: linux/amd64,linux/arm64
- name: 'Docker meta'
id: meta
uses: docker/metadata-action@v5
with:
images: srgr0/misskey
- name: 'Log in to GitHub Container Repository'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: srgr0
password: ${{ secrets.GITHUB_TOKEN }}
- name: 'Build and Push to GitHub Container Repository'
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
push: true
platforms: ${{ steps.buildx.outputs.platforms }}
provenance: false
tags: ghcr.io/srgr0/misskey:${{ steps.get_branch.outputs.branch }}
labels: ${{ steps.get_branch.outputs.branch }}
cache-from: type=gha
cache-to: type=gha,mode=max
# push-to-acr:
# name: 'Push Docker image to Azure Container Registory'
# runs-on: ubuntu-latest
# steps:
# - name: 'Checkout GitHub Action'
# uses: actions/checkout@main
# with:
# ref: ${{ github.event.inputs.branch || github.ref }}
#
# - name: Get branch name
# id: get_branch
# run: echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT
#
# - name: 'Set up Docker Buildx'
# id: buildx
# uses: docker/setup-buildx-action@v3.0.0
# with:
# platforms: linux/amd64,linux/arm64
#
# - name: 'Docker meta'
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: srgr0/misskey
#
# - name: 'Login via Azure CLI'
# uses: azure/login@v1
# with:
# creds: ${{ secrets.AZURE_CREDENTIALS
#
# - name: 'Log in to Azure Container Registory'
# uses: azure/docker-login@v1
# with:
# login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
# username: ${{ secrets.REGISTRY_USERNAME }}
# password: ${{ secrets.REGISTRY_PASSWORD }}
# - run: |
# docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/misskey:${{ steps.get_branch.outputs.branch }}
# docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/misskey:${{ steps.get_branch.outputs.branch }}
push_to_quay:
name: 'Push Docker image to quay'
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- name: Get branch name
id: get_branch
run: echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT
- name: 'Set up Docker Buildx'
id: buildx
uses: docker/setup-buildx-action@v3.0.0
with:
platforms: linux/amd64,linux/arm64
- name: 'Docker meta'
id: meta
uses: docker/metadata-action@v5
with:
images: srgr0/misskey
- name: 'Log in to quay'
uses: docker/login-action@v2
with:
registry: quay.io
username: srgr0
password: ${{ secrets.QUAY_PASSWORD_ENCRYPTED }}
- name: 'Build and Push to quay'
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
push: true
platforms: ${{ steps.buildx.outputs.platforms }}
provenance: false
tags: quay.io/srgr0/misskey:${{ steps.get_branch.outputs.branch }}
labels: ${{ steps.get_branch.outputs.branch }}
cache-from: type=gha
cache-to: type=gha,mode=max
trigger_mkexp_deploy:
name: 'Trigger mkexp-deploy Dispatch Event'
if: github.ref == 'refs/heads/develop-srgr0'
runs-on: ubuntu-latest
needs: push_to_quay
steps:
- name: 'Trigger Dispatch Event'
run: |
curl -X POST -H "Authorization: token ${{ secrets.GH_TOKEN_FOR_DISPATCH }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/srgr0/mkexp-deploy/actions/workflows/mkexp-deploy.yml/dispatches \
-d '{"ref":"main"}'