Fix gitea artifacts and add docker cache layer
This commit is contained in:
@@ -24,12 +24,16 @@ jobs:
|
|||||||
run: sudo apt-get update && sudo apt-get install -y tar
|
run: sudo apt-get update && sudo apt-get install -y tar
|
||||||
- name: Install telegram bot library
|
- name: Install telegram bot library
|
||||||
run: dotnet nuget add source https://pkgs.dev.azure.com/tgbots/Telegram.Bot/_packaging/release/nuget/v3/index.json -n Telegram.Bot
|
run: dotnet nuget add source https://pkgs.dev.azure.com/tgbots/Telegram.Bot/_packaging/release/nuget/v3/index.json -n Telegram.Bot
|
||||||
- name: dotnet restore
|
|
||||||
run: dotnet restore --no-cache
|
|
||||||
- name: dotnet publish
|
- name: dotnet publish
|
||||||
run: dotnet publish -c Release -r linux-x64 --self-contained true /p:PublishSingleFile=true /p:PublishTrimmed=false /p:EnableCompressionInSingleFile=true
|
run: dotnet publish -c Release -r linux-x64 --self-contained true /p:PublishSingleFile=true /p:PublishTrimmed=false /p:EnableCompressionInSingleFile=true
|
||||||
- name: Create tarball
|
- name: Create tarball
|
||||||
run: tar -czvf publish.tar.gz -C bin/Release/net9.0/linux-x64/publish/ .
|
run: tar -czvf publish.tar.gz -C bin/Release/net9.0/linux-x64/publish/ .
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: publish-tarball
|
||||||
|
path: publish.tar.gz
|
||||||
|
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
name: Build and push Docker image
|
name: Build and push Docker image
|
||||||
@@ -39,12 +43,22 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with:
|
||||||
|
install: true
|
||||||
- name: Log in to Container registry
|
- name: Log in to Container registry
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: git.mahdium.ir
|
registry: git.mahdium.ir
|
||||||
username: ${{ secrets.USERNAME }}
|
username: ${{ secrets.USERNAME }}
|
||||||
password: ${{ secrets.PASSWORD }}
|
password: ${{ secrets.PASSWORD }}
|
||||||
|
- name: Cache Docker layers
|
||||||
|
id: cache-layers
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
- name: Extract Docker metadata
|
- name: Extract Docker metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v4
|
||||||
@@ -57,3 +71,5 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
|
Reference in New Issue
Block a user