Docker-publish #518
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker-publish | |
on: | |
push: | |
# Publish `master` as Docker `latest` image. | |
branches: | |
- master | |
# Publish `v1.2.3` tags as releases. | |
tags: | |
- v* | |
# Run tests for any PRs. | |
pull_request: | |
branches: | |
- master | |
schedule: | |
- cron: "0 2 * * *" | |
workflow_dispatch: | |
inputs: | |
name: | |
description: '备注' | |
required: true | |
default: 'Mona the Octocat' | |
check_suite: | |
types: [rerequested, completed] | |
env: | |
# TODO: Change variable to your image's name. | |
IMAGE_NAME: scjtqs/go-tg:test | |
jobs: | |
# Run tests. | |
# See also https://docs.docker.com/docker-hub/builds/automated-testing/ | |
# test: | |
# runs-on: ubuntu-latest | |
# | |
# steps: | |
# - uses: actions/checkout@v2 | |
# | |
# - name: Run tests | |
# run: | | |
# if [ -f docker-compose.test.yml ]; then | |
# docker-compose --file docker-compose.test.yml build | |
# docker-compose --file docker-compose.test.yml run sut | |
# else | |
# docker build . --file Dockerfile | |
# fi | |
# Push image to GitHub Packages. | |
# See also https://docs.docker.com/docker-hub/builds/ | |
alpine: | |
# Ensure test job passes before pushing image. | |
# needs: test | |
runs-on: ubuntu-latest | |
# if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to docker Registry | |
uses: docker/login-action@v3 | |
if: github.event_name != 'pull_request' | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# - name: Log into registry | |
# run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
# - name: Log into aliyun repo | |
# run: echo "${{ secrets.DOCKER_PASSWORD2 }}" | docker login -u ${{ secrets.DOCKER_USERNAME2 }} registry.cn-hangzhou.aliyuncs.com --password-stdin | |
# - name: Push image | |
# run: docker push $IMAGE_NAME | |
# - name: buildx-bullseye | |
# run: ./buildtg-bullseye.sh | |
- name: buildx-alpine | |
run: | | |
source ./VERSION | |
docker buildx build --tag scjtqs/go-tg:${BUILD_VERSION} --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg BUILD_VERSION="${BUILD_VERSION}" --build-arg TD_GIT_COMMIT="${TD_GIT_COMMIT}" --push -f alpine.go-td.Dockerfile . || exit 2 | |
bullseye: | |
# Ensure test job passes before pushing image. | |
# needs: test | |
runs-on: ubuntu-latest | |
# if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to docker Registry | |
uses: docker/login-action@v3 | |
if: github.event_name != 'pull_request' | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# - name: Log into registry | |
# run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
# - name: Log into aliyun repo | |
# run: echo "${{ secrets.DOCKER_PASSWORD2 }}" | docker login -u ${{ secrets.DOCKER_USERNAME2 }} registry.cn-hangzhou.aliyuncs.com --password-stdin | |
# - name: Push image | |
# run: docker push $IMAGE_NAME | |
- name: buildx-bullseye | |
run: | | |
source ./VERSION | |
docker buildx build --tag scjtqs/go-tg:${BUILD_VERSION}-debian --platform linux/amd64,linux/arm64,linux/arm/v7 --build-arg BUILD_VERSION="${BUILD_VERSION}" --build-arg TD_GIT_COMMIT="${TD_GIT_COMMIT}" --push -f bullseye.go-td.Dockerfile . || exit 2 |