Compare commits
5 commits
ci/forgejo
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 65b7f84dbe | |||
| a3fd5f212e | |||
| 80ba98478b | |||
| 31a5808b81 | |||
| 57c729f991 |
1 changed files with 20 additions and 6 deletions
|
|
@ -9,30 +9,43 @@ on:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: catthehacker/ubuntu:act-latest
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Extract Registry Host
|
||||||
|
id: reg
|
||||||
|
run: |
|
||||||
|
SERVER_HOST=$(echo "${{ gitea.server_url }}" | sed -e 's|^https\?://||')
|
||||||
|
echo "host=${SERVER_HOST}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to Forgejo Container Registry
|
- name: Log in to Forgejo Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ gitea.server_url }}
|
registry: ${{ steps.reg.outputs.host }}
|
||||||
username: ${{ gitea.actor }}
|
username: ${{ gitea.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.REGISTRY_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Extract Metadata for Docker
|
- name: Extract Metadata for Docker
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ${{ gitea.server_url }}/${{ gitea.repository }}
|
images: ${{ steps.reg.outputs.host }}/${{ gitea.repository }}
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/main' || gitea.ref == 'refs/heads/master' }}
|
type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/main' || gitea.ref == 'refs/heads/master' }}
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
|
|
@ -46,8 +59,7 @@ 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=gha
|
provenance: false
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
create-release:
|
create-release:
|
||||||
needs: build-and-push
|
needs: build-and-push
|
||||||
|
|
@ -55,6 +67,8 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: catthehacker/ubuntu:act-latest
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -72,7 +86,7 @@ jobs:
|
||||||
echo "Creating release ${RELEASE_NAME} with tag ${TAG_NAME}..."
|
echo "Creating release ${RELEASE_NAME} with tag ${TAG_NAME}..."
|
||||||
|
|
||||||
curl -s -X POST "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" \
|
curl -s -X POST "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" \
|
||||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.REGISTRY_TOKEN || secrets.GITHUB_TOKEN }}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{
|
-d "{
|
||||||
\"tag_name\": \"${TAG_NAME}\",
|
\"tag_name\": \"${TAG_NAME}\",
|
||||||
|
|
|
||||||
Reference in a new issue