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