This commit is contained in:
+24
-25
@@ -1,6 +1,7 @@
|
||||
# Gitea Actions — Copyparty Content Tag CI
|
||||
# Fully Docker-based: no host-side tooling (no Node.js, no git) required.
|
||||
# Every step runs inside a Docker container with its own dependencies.
|
||||
# Runs on docker runner; every step uses a Docker container for its dependencies.
|
||||
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -11,24 +12,24 @@ on:
|
||||
types: [created]
|
||||
|
||||
env:
|
||||
WS: /ws
|
||||
WS: /workspace
|
||||
GITEA_HOST: gitea.mse:80
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: docker
|
||||
|
||||
# Shared workspace volume so containers can pass files between steps
|
||||
container:
|
||||
image: alpine:latest
|
||||
|
||||
steps:
|
||||
# --- Clone repo inside an Alpine container with git ---
|
||||
# --- Clone repo using x-access-token auth ---
|
||||
- name: Checkout Source
|
||||
run: |
|
||||
apk add --no-cache git
|
||||
mkdir -p $WS && cd $WS
|
||||
git clone $GITEA_REPOSITORY_URL .
|
||||
git checkout $GITEA_REVISION
|
||||
mkdir -p $WS
|
||||
cd $WS
|
||||
git clone "http://x-access-token:${{ secrets.PKG_TOKEN }}@${{ env.GITEA_HOST }}/${{ github.repository }}.git" .
|
||||
git checkout ${{ github.sha }}
|
||||
|
||||
# --- TSV Unit Tests inside Node container ---
|
||||
- name: TSV Unit Tests
|
||||
@@ -42,7 +43,6 @@ jobs:
|
||||
# --- Copyparty API Sanity Tests ---
|
||||
- name: Prepare Test Data & Config
|
||||
run: |
|
||||
apk add --no-cache curl
|
||||
mkdir -p /tmp/copyparty-data/public /tmp/copyparty-data/private/user
|
||||
|
||||
cat > /tmp/copyparty-config.ini <<'EOF'
|
||||
@@ -84,16 +84,13 @@ jobs:
|
||||
|
||||
- name: Cleanup Test Container
|
||||
if: always()
|
||||
run: |
|
||||
apk add --no-cache curl
|
||||
docker stop cp-test && docker rm cp-test || true
|
||||
run: docker stop cp-test && docker rm cp-test || true
|
||||
|
||||
# --- Release Build ---
|
||||
release:
|
||||
needs: test
|
||||
if: github.event_name == 'release'
|
||||
runs-on: docker
|
||||
|
||||
container:
|
||||
image: alpine:latest
|
||||
|
||||
@@ -101,17 +98,19 @@ jobs:
|
||||
- name: Checkout Source
|
||||
run: |
|
||||
apk add --no-cache git
|
||||
mkdir -p $WS && cd $WS
|
||||
git clone $GITEA_REPOSITORY_URL .
|
||||
git checkout $GITEA_REVISION
|
||||
mkdir -p $WS
|
||||
cd $WS
|
||||
git clone "http://x-access-token:${{ secrets.PKG_TOKEN }}@${{ env.GITEA_HOST }}/${{ github.repository }}.git" .
|
||||
git checkout ${{ github.sha }}
|
||||
|
||||
# --- Build release artifact inside Alpine container ---
|
||||
# --- Build release artifact ---
|
||||
- name: Build Release Artifact
|
||||
run: |
|
||||
apk add --no-cache tar coreutils
|
||||
mkdir -p /release/copyparty-content-tag
|
||||
cp src/*.html src/*.css src/*.js /release/copyparty-content-tag/
|
||||
cd /release
|
||||
cd $WS
|
||||
mkdir -p release/copyparty-content-tag
|
||||
cp src/*.html src/*.css src/*.js release/copyparty-content-tag/
|
||||
cd release
|
||||
sha256sum copyparty-content-tag/* > checksums.sha256
|
||||
tar czf copyparty-content-tag.tar.gz copyparty-content-tag/
|
||||
|
||||
@@ -119,9 +118,9 @@ jobs:
|
||||
- name: Upload Release Artifact
|
||||
run: |
|
||||
apk add --no-cache curl
|
||||
TAG=$(echo "$GITEA_REF" | sed 's|refs/tags||')
|
||||
TAG=$(echo "${{ github.ref }}" | sed 's|refs/tags||')
|
||||
curl -sSf -X POST \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Authorization: token ${{ secrets.PKG_TOKEN }}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @/release/copyparty-content-tag.tar.gz \
|
||||
"$GITEA_SERVER_URL/api/repos/$GITEA_REPOSITORY/releases.attachments?name=copyparty-content-tag.tar.gz&tag=$TAG"
|
||||
--data-binary @$WS/release/copyparty-content-tag.tar.gz \
|
||||
"http://${{ env.GITEA_HOST }}/api/v1/repos/${{ github.repository }}/releases.attachments?name=copyparty-content-tag.tar.gz&tag=$TAG"
|
||||
|
||||
Reference in New Issue
Block a user