123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- name: Build Image and Publish to Dockerhub & GPR
- on:
- release:
- types: [ created ]
- workflow_dispatch:
- inputs:
- tag:
- description: 'Image tag'
- required: true
- default: 'test'
- jobs:
- binary:
- name: Build Golang project
- runs-on: ubuntu-latest
- steps:
- -
- name: Set up Go 1.x
- uses: actions/setup-go@v2
- with:
- go-version: 1.15
- -
- run: go version
- -
- name: Check out code into the Go module directory
- uses: actions/checkout@v2
- -
- name: Build
- run: make build
- -
- name: Archive artifacts for frpc
- uses: actions/upload-artifact@v1
- with:
- name: frpc
- path: bin/frpc
- -
- name: Archive artifacts for frps
- uses: actions/upload-artifact@v1
- with:
- name: frps
- path: bin/frps
- image:
- name: Build Image from Dockerfile and binaries
- runs-on: ubuntu-latest
- needs: binary
- steps:
-
- -
- name: Checkout
- uses: actions/checkout@v2
- with:
- fetch-depth: '0'
- -
- name: Set up QEMU
- uses: docker/setup-qemu-action@v1
- -
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v1
-
- -
- name: Download binary of frpc
- uses: actions/download-artifact@v2
- with:
- name: frpc
- path: bin/frpc
- -
- name: Download binary of frps
- uses: actions/download-artifact@v2
- with:
- name: frps
- path: bin/frps
-
- -
- name: Get Image Tag Name
- run: |
- if [ x${{ github.event.inputs.tag }} == x"" ]; then
- echo ::set-env name=TAG_NAME::${GITHUB_REF
- else
- echo ::set-env name=TAG_NAME::${{ github.event.inputs.tag }}
- fi
-
- -
- name: Prepare Image Tags
- run: |
- echo ::set-env name=DOCKERFILE_FRPC_PATH::dockerfiles/Dockerfile-for-frpc
- echo ::set-env name=DOCKERFILE_FRPS_PATH::dockerfiles/Dockerfile-for-frps
- echo ::set-env name=TAG_FRPC::fatedier/frpc:$TAG_NAME
- echo ::set-env name=TAG_FRPS::fatedier/frps:$TAG_NAME
- echo ::set-env name=TAG_FRPC_GPR::ghcr.io/fatedier/frpc:$TAG_NAME
- echo ::set-env name=TAG_FRPS_GPR::ghcr.io/fatedier/frps:$TAG_NAME
-
- -
- name: Build Images
- run: |
-
- docker build
- docker build
-
- docker build
- docker build
-
- -
- name: Publish to Dockerhub
- run: |
- echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login
- docker push $TAG_FRPC
- docker push $TAG_FRPC
-
- -
- name: Publish to GPR
- run: |
- echo ${{ secrets.GPR_TOKEN }} | docker login ghcr.io
- docker push $TAG_FRPC_GPR
- docker push $TAG_FRPS_GPR
|