ci: Fix Forgejo workflow for local runner
This commit is contained in:
parent
7469c6e64f
commit
b5d3c78b44
1 changed files with 15 additions and 28 deletions
|
|
@ -11,40 +11,27 @@ env:
|
|||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: synology-runner
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
run: |
|
||||
git clone https://git.khoavo.myds.me/vndangkhoa/monochrome.git /workspace/monochrome
|
||||
cd /workspace/monochrome
|
||||
git checkout $GITHUB_SHA
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
run: docker buildx create --name mybuilder --use || docker buildx use mybuilder
|
||||
|
||||
- name: Login to Forgejo Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.FORGEJO_USERNAME }}
|
||||
password: ${{ secrets.FORGEJO_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=sha,prefix=
|
||||
type=raw,value=latest
|
||||
run: |
|
||||
echo "${{ secrets.FORGEJO_TOKEN }}" | docker login ${{ env.REGISTRY }} -u "${{ secrets.FORGEJO_USERNAME }}" --password-stdin
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./docker/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
run: |
|
||||
cd /workspace/monochrome
|
||||
TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$(echo $GITHUB_SHA | cut -c1-8)"
|
||||
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
|
||||
TAG="$TAG ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:latest"
|
||||
fi
|
||||
docker buildx build --platform linux/amd64 -t $TAG -f docker/Dockerfile --push .
|
||||
|
|
|
|||
Loading…
Reference in a new issue