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:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: synology-runner
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- 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
|
- 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
|
- name: Login to Forgejo Container Registry
|
||||||
uses: docker/login-action@v3
|
run: |
|
||||||
with:
|
echo "${{ secrets.FORGEJO_TOKEN }}" | docker login ${{ env.REGISTRY }} -u "${{ secrets.FORGEJO_USERNAME }}" --password-stdin
|
||||||
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
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v5
|
run: |
|
||||||
with:
|
cd /workspace/monochrome
|
||||||
context: .
|
TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$(echo $GITHUB_SHA | cut -c1-8)"
|
||||||
file: ./docker/Dockerfile
|
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
|
||||||
push: true
|
TAG="$TAG ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:latest"
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
fi
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
docker buildx build --platform linux/amd64 -t $TAG -f docker/Dockerfile --push .
|
||||||
platforms: linux/amd64
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue