Adopt shared ci-actions for publishing
Replace inline publish step(s) with the canonical shell-only composite actions in andras/ci-actions. Switches the publish jobs to the registered 'docker' runner. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d99e249fa5
commit
339e17d27d
3 changed files with 21 additions and 86 deletions
|
|
@ -9,7 +9,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-docker:
|
publish-docker:
|
||||||
runs-on: ubuntu-docker
|
runs-on: docker
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|
@ -17,35 +17,11 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Extract registry hostname
|
- name: Build and publish CLI image
|
||||||
id: registry
|
uses: http://forgejo:3000/andras/ci-actions/docker-publish@main
|
||||||
run: echo "host=$(echo '${{ github.server_url }}' | sed 's|https\?://||')" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log into container registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ steps.registry.outputs.host }}
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract Docker metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ steps.registry.outputs.host }}/${{ github.repository }}-cli
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
id: build-and-push
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
with:
|
||||||
context: frontend
|
context: frontend
|
||||||
file: frontend/local-client-cli/Dockerfile
|
dockerfile: frontend/local-client-cli/Dockerfile
|
||||||
platforms: linux/amd64
|
image-suffix: -cli
|
||||||
push: true
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
cache-from: type=registry,ref=${{ steps.registry.outputs.host }}/${{ github.repository }}-cli:buildcache
|
|
||||||
cache-to: type=registry,ref=${{ steps.registry.outputs.host }}/${{ github.repository }}-cli:buildcache,mode=max
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ env:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-plugin:
|
publish-plugin:
|
||||||
runs-on: ubuntu-latest
|
runs-on: docker
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
@ -28,7 +28,7 @@ jobs:
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
- name: Setup Rust toolchain
|
- name: Setup Rust toolchain
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: https://github.com/dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
toolchain: "1.92.0"
|
toolchain: "1.92.0"
|
||||||
components: clippy, rustfmt
|
components: clippy, rustfmt
|
||||||
|
|
@ -41,31 +41,15 @@ jobs:
|
||||||
- name: Build Linux and Windows binaries
|
- name: Build Linux and Windows binaries
|
||||||
run: ./scripts/build-sync-server-binaries.sh
|
run: ./scripts/build-sync-server-binaries.sh
|
||||||
|
|
||||||
- name: Create release
|
- name: Stage release assets
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
SERVER_URL: ${{ github.server_url }}
|
|
||||||
REPO: ${{ github.repository }}
|
|
||||||
run: |
|
run: |
|
||||||
tag="${GITHUB_REF#refs/tags/}"
|
|
||||||
|
|
||||||
mkdir -p release
|
mkdir -p release
|
||||||
cp frontend/obsidian-plugin/dist/* release/
|
cp frontend/obsidian-plugin/dist/* release/
|
||||||
cp sync-server/artifacts/sync-server-* release/
|
cp sync-server/artifacts/sync-server-* release/
|
||||||
|
|
||||||
# Create draft release via Forgejo API
|
- name: Create draft release
|
||||||
RELEASE_ID=$(curl -s -X POST \
|
uses: http://forgejo:3000/andras/ci-actions/forgejo-release@main
|
||||||
"${SERVER_URL}/api/v1/repos/${REPO}/releases" \
|
with:
|
||||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
-H "Content-Type: application/json" \
|
files: release
|
||||||
-d "{\"tag_name\": \"${tag}\", \"name\": \"${tag}\", \"draft\": true}" \
|
draft: "true"
|
||||||
| jq -r '.id')
|
|
||||||
|
|
||||||
# Upload release assets
|
|
||||||
for file in release/*; do
|
|
||||||
filename=$(basename "$file")
|
|
||||||
curl -s -X POST \
|
|
||||||
"${SERVER_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${filename}" \
|
|
||||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
|
||||||
-F "attachment=@${file}"
|
|
||||||
done
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-docker:
|
publish-docker:
|
||||||
runs-on: ubuntu-docker
|
runs-on: docker
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|
@ -17,35 +17,10 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Extract registry hostname
|
- name: Build and publish server image
|
||||||
id: registry
|
uses: http://forgejo:3000/andras/ci-actions/docker-publish@main
|
||||||
run: echo "host=$(echo '${{ github.server_url }}' | sed 's|https\?://||')" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log into container registry
|
|
||||||
if: github.ref_type == 'tag'
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ steps.registry.outputs.host }}
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract Docker metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ steps.registry.outputs.host }}/${{ github.repository }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
id: build-and-push
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
with:
|
||||||
context: sync-server
|
context: sync-server
|
||||||
platforms: linux/amd64,linux/arm64
|
# Push only on tags (matches the previous workflow's behaviour).
|
||||||
push: ${{ github.ref_type == 'tag' }}
|
push: ${{ github.ref_type == 'tag' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
cache-from: type=registry,ref=${{ steps.registry.outputs.host }}/${{ github.repository }}:buildcache
|
|
||||||
cache-to: type=registry,ref=${{ steps.registry.outputs.host }}/${{ github.repository }}:buildcache,mode=max
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue