test docker build push

This commit is contained in:
千里走单骑 2024-04-02 01:20:55 +08:00
parent 5308b89d50
commit 8ef1d88a13
2 changed files with 28 additions and 20 deletions

View File

@ -3,8 +3,8 @@ run-name: ${{ github.actor }} Gitea Actions 🚀🚀🚀
on:
push:
# Sequence of patterns matched against refs/heads
# branches:
# - main
branches:
- main
# Sequence of patterns matched against refs/tags
tags:
- v*
@ -15,9 +15,7 @@ env:
# 此处可修改为你任意 docker 镜像仓库地址和用户名
DOMAIN: gitea.lntu.edu.cn
# DOMAIN: softyouling-docker.pkg.coding.net
IMAGE_NAME: code/demo/demo
GITOPS_URL: ${{ env.DOMAIN }}/${{ secrets.GITOPS_REPO }}
# IMAGE_NAME: code/demo/demo
jobs:
build:
@ -39,26 +37,36 @@ jobs:
uses: https://${{ env.DOMAIN }}/actions/checkout@v4
# Docker配置多平台环境
- name: Docker配置多平台环境
uses: https://${{ env.DOMAIN }}/actions/setup-buildx-action@v3
# - name: Docker配置多平台环境
# uses: https://${{ env.DOMAIN }}/actions/setup-buildx-action@v3
- name: 获取当前时间
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d%H%M%S')"
# - name: 获取当前时间
# id: date
# run: echo "::set-output name=date::$(date +'%Y%m%d%H%M%S')"
- name: 构建 & 推送镜像
uses: https://${{ env.DOMAIN }}/actions/docker-build-push@v6
# - name: 构建 & 推送镜像
# uses: https://${{ env.DOMAIN }}/actions/docker-build-push@v6
# with:
# image: ${{ gitea.repository }}
# tags: ${{ github.sha }}
# registry: softyouling-docker.pkg.coding.net
# enableBuildKit: true
# # multiPlatform: true
# # platform: linux/amd64,linux/arm64,linux/arm/v7
# dockerfile: Dockerfile
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
- name: 🐬镜像构建推送
uses: https://${{ env.DOMAIN }}/actions/docker-build-push
with:
image: ${{ env.IMAGE_NAME }}
tags: ${{ github.sha }}
registry: softyouling-docker.pkg.coding.net
image: ${{ gitea.repository }}
tags: ${{ gitea.sha }}
registry: ${{ env.DOMAIN }}
# enableBuildKit: true
# multiPlatform: true
# platform: linux/amd64,linux/arm64,linux/arm/v7
provenance: false
dockerfile: Dockerfile
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
gtiops:
runs-on: ubuntu-latest
if: ${{ success() }}
@ -69,7 +77,7 @@ jobs:
uses: https://${{ env.DOMAIN }}/actions/gitops-action@main
with:
gitops-token: ${{ secrets.GITOPS_TOKEN }}
gitops-url: ${{ env.GITOPS_URL }}
gitops-url: ${{ env.DOMAIN }}/${{ secrets.GITOPS_REPO }}
commit-email: "gitops@lntu.edu.cn"
commit-name: "千里走单骑"
file-name: ${{ secrets.FILE_NAME }}

View File

@ -10,7 +10,7 @@ jobs:
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository