2023-04-04 09:29:56 -04:00
|
|
|
|
name: GitHub Actions Docker Buildx
|
|
|
|
|
on:
|
|
|
|
|
workflow_dispatch:
|
|
|
|
|
push:
|
|
|
|
|
branches:
|
2023-04-04 23:50:59 -04:00
|
|
|
|
- 'develop-zh'
|
|
|
|
|
release:
|
|
|
|
|
types: [published]
|
2023-04-04 09:29:56 -04:00
|
|
|
|
jobs:
|
|
|
|
|
Docker-Buildx:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
|
|
|
|
- name: Checkout
|
|
|
|
|
uses: actions/checkout@v3
|
2023-04-04 23:50:59 -04:00
|
|
|
|
- name: 添加Build环境变量
|
|
|
|
|
run: |
|
|
|
|
|
echo "BUILD_IMAGE=chishin/nginx-proxy-manager-zh" >> $GITHUB_ENV
|
|
|
|
|
echo "BUILD_PLATFORM=linux/amd64,linux/arm64,linux/arm/7" >> $GITHUB_ENV
|
|
|
|
|
echo "BUILD_VERSION=$(cat .version)" >> $GITHUB_ENV
|
|
|
|
|
- name: 添加BuildTag环境变量(push)
|
|
|
|
|
if: ${{ github.event_name == 'push'}}
|
|
|
|
|
run: |
|
|
|
|
|
echo "BUILD_TAG=-t ${BUILD_IMAGE}:${BUILD_VERSION} -t ${BUILD_IMAGE}:dev" >> $GITHUB_ENV
|
|
|
|
|
- name: 添加BuildTag环境变量(release)
|
|
|
|
|
if: ${{ github.event_name == 'release'}}
|
|
|
|
|
run: |
|
|
|
|
|
echo "BUILD_TAG=-t ${BUILD_IMAGE}:${BUILD_VERSION} -t ${BUILD_IMAGE}:${BUILD_VERSION%.*} -t ${BUILD_IMAGE}:${BUILD_VERSION%.*.*} -t ${BUILD_IMAGE}:release" >> $GITHUB_ENV
|
|
|
|
|
- name: 登录DockerHub账号
|
2023-04-04 09:29:56 -04:00
|
|
|
|
env:
|
|
|
|
|
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
|
|
|
|
|
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
|
|
|
|
|
run: echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
|
|
|
|
- name: Docker Setup Buildx
|
|
|
|
|
uses: docker/setup-buildx-action@v2.5.0
|
2023-04-04 23:50:59 -04:00
|
|
|
|
- name: 输出Buildx环境变量
|
|
|
|
|
run: |
|
|
|
|
|
echo "BUILD_TAG=$BUILD_TAG"
|
|
|
|
|
echo "BUILD_IMAGE=$BUILD_IMAGE"
|
|
|
|
|
echo "BUILD_PLATFORM=$BUILD_PLATFORM"
|
|
|
|
|
echo "BUILD_VERSION=$BUILD_VERSION"
|
|
|
|
|
- name: Buildx Dockerfile
|
2023-04-04 09:29:56 -04:00
|
|
|
|
run: |
|
2023-04-04 23:50:59 -04:00
|
|
|
|
chmod -R 755 scripts
|
2023-04-04 10:29:38 -04:00
|
|
|
|
./scripts/buildx-zh
|
2023-04-04 09:29:56 -04:00
|
|
|
|
|