123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- name: "docker build release"
- on:
- push:
- workflow_dispatch:
- env:
- PROJECT: frps
- jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v2.3.5
- - name: Set tag
- id: tag
- run: |
- if [[ -n $(cat Dockerfile | awk '{if($1~"ENV" && $2=="VERSION")print $3}') ]]; then
- VERSION=$(cat Dockerfile | awk '{if($1~"ENV" && $2=="VERSION")print $3}')
- echo "tag=$VERSION" >> $GITHUB_ENV
- else
- echo "tag=$(date +%Y)-$(date +%m)-$(date +%d)" >> $GITHUB_ENV
- fi
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v1
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v1
- - name: Login Docker Hub
- uses: docker/login-action@v1
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
- - name: Build and push to docker hub
- uses: docker/build-push-action@v2
- with:
- context: .
- platforms: linux/amd64,linux/arm64
- push: true
- tags: |
- ${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT }}:latest
- ${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT }}:${{ env.tag }}
- - name: Sync README.md to Docker Hub
- uses: ms-jpq/sync-dockerhub-readme@v1
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
- repository: ${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT }}
- readme: "./README.md"
- - name: Login harbor
- uses: docker/login-action@v1
- with:
- registry: ${{ secrets.HARBOR_REGISTRY }}
- username: ${{ secrets.HARBOR_USERNAME }}
- password: ${{ secrets.HARBOR_PASSWORD }}
- - name: Build and push to harbor
- uses: docker/build-push-action@v2
- with:
- context: .
- platforms: linux/amd64,linux/arm64
- push: true
- tags: |
- ${{ secrets.HARBOR_REGISTRY }}/${{ secrets.HARBOR_USERNAME }}/${{ env.PROJECT }}:latest
- ${{ secrets.HARBOR_REGISTRY }}/${{ secrets.HARBOR_USERNAME }}/${{ env.PROJECT }}:${{ env.tag }}
|