2023-08-24 13:28:17 +03:00
|
|
|
# Copyright 2023 The Forgejo Authors.
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
version: "3"
|
|
|
|
|
|
|
|
services:
|
|
|
|
|
|
|
|
demo-workflow:
|
|
|
|
image: alpine:3.18
|
|
|
|
links:
|
|
|
|
- forgejo
|
|
|
|
depends_on:
|
|
|
|
runner-register:
|
|
|
|
condition: service_completed_successfully
|
|
|
|
command: >-
|
|
|
|
sh -xc '
|
|
|
|
apk add --quiet git curl jq ;
|
|
|
|
mkdir -p /srv/demo ;
|
|
|
|
cd /srv/demo ;
|
|
|
|
git init --initial-branch=main ;
|
|
|
|
mkdir -p .forgejo/workflows ;
|
2023-10-06 17:18:09 +03:00
|
|
|
echo "{ on: [push], jobs: { test: { runs-on: docker, steps: [ {uses: actions/checkout@v4}, { run: echo All Good } ] } } }" > .forgejo/workflows/demo.yml ;
|
2023-08-24 13:28:17 +03:00
|
|
|
git add . ;
|
|
|
|
git config user.email root@example.com ;
|
|
|
|
git config user.name username ;
|
|
|
|
git commit -m 'demo' ;
|
|
|
|
while : ; do
|
2023-09-04 19:19:15 +03:00
|
|
|
git push --set-upstream --force http://root:{ROOT_PASSWORD}@forgejo:3000/root/test main && break ;
|
2023-08-24 13:28:17 +03:00
|
|
|
sleep 5 ;
|
|
|
|
done ;
|
|
|
|
sha=`git rev-parse HEAD` ;
|
|
|
|
while : ; do
|
|
|
|
curl -sS -f http://forgejo:3000/api/v1/repos/root/test/commits/$$sha/status | jq --raw-output .state | tee status ;
|
|
|
|
grep success status && break ;
|
|
|
|
sleep 5 ;
|
|
|
|
done ;
|
|
|
|
echo DEMO WORKFLOW SUCCESS
|
|
|
|
'
|