frp/.github/workflows/build-and-push-image.yml
2022-04-14 11:05:08 +00:00

85 lines
2.7 KiB
YAML

name: Build Docker Image
on:
release:
types: [ created ]
workflow_dispatch:
inputs:
tag:
description: 'Image tag'
required: true
default: 'test'
jobs:
buildx:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
- name: Get current date
id: date
run: echo "::set-output name=today::$(date +'%Y-%m-%d')"
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
-
name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
-
name: Get Image Tag Name
run: |
if [ x${{ github.event.inputs.tag }} == x"" ]; then
echo "TAG_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
else
echo "TAG_NAME=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
fi
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Login to the GPR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push frpc
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile.frpc
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
tags: |
fatedier/frpc:dev
fatedier/frpc:${{ env.TAG_NAME }}
fatedier/frpc:${{ steps.date.outputs.today }}
ghcr.io/fatedier/frpc:dev
ghcr.io/fatedier/frpc:${{ env.TAG_NAME }}
-
name: Build and push frps
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile.frps
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
tags: |
fatedier/frps:dev
fatedier/frps:${{ env.TAG_NAME }}
fatedier/frps:${{ steps.date.outputs.today }}
ghcr.io/fatedier/frps:dev
ghcr.io/fatedier/frps:${{ env.TAG_NAME }}