Compare commits
No commits in common. "ci/shared-actions" and "main" have entirely different histories.
ci/shared-
...
main
3 changed files with 86 additions and 21 deletions
|
|
@ -9,7 +9,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-docker:
|
publish-docker:
|
||||||
runs-on: docker
|
runs-on: ubuntu-docker
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|
@ -17,11 +17,35 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Build and publish CLI image
|
- name: Extract registry hostname
|
||||||
uses: http://forgejo:3000/andras/ci-actions/docker-publish@main
|
id: registry
|
||||||
|
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
|
||||||
dockerfile: frontend/local-client-cli/Dockerfile
|
file: frontend/local-client-cli/Dockerfile
|
||||||
image-suffix: -cli
|
platforms: linux/amd64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: true
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
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: docker
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
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: https://github.com/dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
toolchain: "1.92.0"
|
toolchain: "1.92.0"
|
||||||
components: clippy, rustfmt
|
components: clippy, rustfmt
|
||||||
|
|
@ -41,15 +41,31 @@ 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: Stage release assets
|
- name: Create release
|
||||||
|
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/
|
||||||
|
|
||||||
- name: Create draft release
|
# Create draft release via Forgejo API
|
||||||
uses: http://forgejo:3000/andras/ci-actions/forgejo-release@main
|
RELEASE_ID=$(curl -s -X POST \
|
||||||
with:
|
"${SERVER_URL}/api/v1/repos/${REPO}/releases" \
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
files: release
|
-H "Content-Type: application/json" \
|
||||||
draft: "true"
|
-d "{\"tag_name\": \"${tag}\", \"name\": \"${tag}\", \"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: docker
|
runs-on: ubuntu-docker
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|
@ -17,10 +17,35 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Build and publish server image
|
- name: Extract registry hostname
|
||||||
uses: http://forgejo:3000/andras/ci-actions/docker-publish@main
|
id: registry
|
||||||
|
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
|
||||||
# Push only on tags (matches the previous workflow's behaviour).
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{ github.ref_type == 'tag' }}
|
push: ${{ github.ref_type == 'tag' }}
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
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