Simplify Forgejo Actions workflow for compatibility
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 17s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 17s
- Remove GitHub Actions marketplace actions (uses directive) - Use shell commands instead for better compatibility - Switch from gitea context to github context variables - Use Docker container to run build commands Fixes YAML schema validation errors in Forgejo runner 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
3d2e06e662
commit
547b232669
1 changed files with 16 additions and 40 deletions
|
|
@ -4,54 +4,30 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
REGISTRY: forgejo.sivic.me
|
||||
IMAGE_NAME: ${{ gitea.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
container:
|
||||
image: docker:latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
run: |
|
||||
apk add --no-cache git
|
||||
git clone ${{ github.server_url }}/${{ github.repository }} .
|
||||
git checkout ${{ github.sha }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
docker build -t forgejo.sivic.me/${{ github.repository }}:latest \
|
||||
-t forgejo.sivic.me/${{ github.repository }}:${{ github.sha }} .
|
||||
|
||||
- name: Log in to Forgejo Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
echo "${{ secrets.GITEA_TOKEN }}" | docker login forgejo.sivic.me -u ${{ github.actor }} --password-stdin
|
||||
|
||||
- name: Extract metadata for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=sha,prefix={{branch}}-
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
|
||||
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
|
||||
- name: Push Docker image
|
||||
run: |
|
||||
docker push forgejo.sivic.me/${{ github.repository }}:latest
|
||||
docker push forgejo.sivic.me/${{ github.repository }}:${{ github.sha }}
|
||||
|
|
|
|||
Loading…
Reference in a new issue