default: image: alpine:latest tags: [ docker ] stages: - commit - pages add-commit: rules: - if: $CI_PIPELINE_SOURCE == "trigger" - if: $CI_PIPELINE_SOURCE == "web" stage: commit before_script: - apk add curl script: - test -z "$CIPRIVATETOKEN" && echo "CIPRIVATETOKEN was empty" - COLON=':' - echo "test" >> test.tsv - echo -n "{\"branch\"${COLON} \"main\", \"commit_message\"${COLON} \"new commit via ci pipeline\", \"actions\"${COLON} [ { \"action\"${COLON} \"update\", \"file_path\"${COLON} \"test.tsv\", \"encoding\"${COLON} \"base64\", \"content\"${COLON} \"" > commit.json - echo -n "$(base64 test.tsv)" >> commit.json - echo -n '" } ] }' >> commit.json - cat commit.json - curl --fail-with-body --request POST --header "PRIVATE-TOKEN${COLON} $CIPRIVATETOKEN" --header "Content-Type${COLON} application/json" --data "$(cat commit.json)" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/commits" pages: rules: - changes: - test.tsv stage: pages script: - mkdir -p public - cp test.tsv public/ - echo '<a href="test.tsv">test.tsv</a>' > public/index.html artifacts: paths: - public