Compare commits
3 Commits
b385c9df02
...
10.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 08d1e667db | |||
| 5fe8fb340f | |||
| 3da94cb973 |
26
action.yml
26
action.yml
@@ -1,18 +1,18 @@
|
|||||||
# action.yml
|
# action.yml
|
||||||
name: 'build docker image and push to code'
|
name: "build docker image and push to code"
|
||||||
description: 'build docker image and push to simcu code'
|
description: "build docker image and push to simcu code"
|
||||||
inputs:
|
inputs:
|
||||||
dockerfile:
|
dockerfile:
|
||||||
description: 'if set, will use this to build'
|
description: "if set, will use this to build"
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ""
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: build .net app
|
- name: build .net app
|
||||||
uses: docker://mcr.microsoft.com/dotnet/sdk:8.0
|
uses: docker://mcr.microsoft.com/dotnet/sdk:10.0
|
||||||
with:
|
with:
|
||||||
args: dotnet publish -r linux-x64 -c Release --self-contained -o dist -p:AssemblyName=App
|
args: dotnet publish -r linux-x64 -c Release --self-contained -o dist -p:AssemblyName=App -p:Version=${{ github.ref_name }}
|
||||||
|
|
||||||
- name: create dockerfile
|
- name: create dockerfile
|
||||||
if: ${{ inputs.dockerfile == '' }}
|
if: ${{ inputs.dockerfile == '' }}
|
||||||
@@ -20,7 +20,7 @@ runs:
|
|||||||
with:
|
with:
|
||||||
entrypoint: "/bin/bash"
|
entrypoint: "/bin/bash"
|
||||||
args: |
|
args: |
|
||||||
-c 'echo "FROM mcr.microsoft.com/dotnet/runtime:8.0" > Dockerfile && \
|
-c 'echo "FROM mcr.microsoft.com/dotnet/runtime:10.0" > Dockerfile && \
|
||||||
echo "ENV TZ Asia/Shanghai" >> Dockerfile && \
|
echo "ENV TZ Asia/Shanghai" >> Dockerfile && \
|
||||||
echo "COPY dist /home" >> Dockerfile && \
|
echo "COPY dist /home" >> Dockerfile && \
|
||||||
echo "WORKDIR /home" >> Dockerfile && \
|
echo "WORKDIR /home" >> Dockerfile && \
|
||||||
@@ -33,8 +33,8 @@ runs:
|
|||||||
with:
|
with:
|
||||||
entrypoint: "/bin/sh"
|
entrypoint: "/bin/sh"
|
||||||
args: |
|
args: |
|
||||||
-c 'cat ${{ inputs.dockerfile || 'Dockerfile' }} && docker build -t ${{env.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }} -f ${{ inputs.dockerfile || 'Dockerfile' }} . && \
|
-c 'cat ${{ inputs.dockerfile || 'Dockerfile' }} && docker build -t ${{vars.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }} -f ${{ inputs.dockerfile || 'Dockerfile' }} . && \
|
||||||
echo ${{env.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }}已经构建完了 && \
|
echo ${{vars.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }}已经构建完了 && \
|
||||||
docker login ${{env.DOCKER_REGISTRY}} -u ${{env.DOCKER_USER}} -p ${{env.DOCKER_PASS}} && \
|
docker login ${{vars.DOCKER_REGISTRY}} -u ${{vars.DOCKER_USER}} -p ${{vars.DOCKER_PASS}} && \
|
||||||
docker push ${{env.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }} && \
|
docker push ${{vars.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }} && \
|
||||||
echo ${{env.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }}推送成功'
|
echo ${{vars.DOCKER_REGISTRY}}/${{github.repository}}:${{ github.ref_name }}推送成功'
|
||||||
|
|||||||
Reference in New Issue
Block a user