aboutsummaryrefslogtreecommitdiff
path: root/.woodpecker.yml
blob: a4e35a280536384b44620d951296bb28c946615e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# .woodpecker.yml
steps:
  publish:
    image: docker:stable  # Use docker image so we can docker login
    environment:
      DOCKER_USER:
        from_secret: DOCKER_USER
      DOCKER_PASS:
        from_secret: DOCKER_PASS
      CBMAIL:
        from_secret: "mail"
      CBTOKEN:
        from_secret: "codeberg_token"
    commands:
      # Log in to Docker Hub to bypass pull rate limits
      - docker login -u $DOCKER_USER -p $DOCKER_PASS

      # Pull Alpine image for build environment
      - docker pull alpine:edge

      # Run build commands inside Alpine container
      - docker run --rm -v $PWD:/workspace -w /workspace alpine:edge sh -c "
          apk add --no-cache git curl &&
          cd website &&
          chmod +x ./build.sh &&
          ./build.sh
        "

      # Configure Git
      - git config --global user.email "$${CBMAIL}"
      - git config --global user.name "Woodpecker CI"

      # Push to pages branch
      - git clone -b pages https://$${CBTOKEN}@codeberg.org/$CI_REPO.git $CI_REPO_NAME
      - cd $CI_REPO_NAME
      - git rm -r "*" || true
      - cp -ar ../public/. ../.domains . || true
      - git add --all
      - git commit -m "Woodpecker CI ${CI_COMMIT_SHA} [SKIP CI]" --allow-empty
      - git push
      - cd ..
      - rm -rf $CI_REPO_NAME

      # Push to core branch
      - git clone -b core https://$${CBTOKEN}@codeberg.org/$CI_REPO.git $CI_REPO_NAME
      - cd $CI_REPO_NAME
      - git rm -r "*" || true
      - cp -ar ../repos/core/. . || true
      - git add --all
      - git commit -m "Woodpecker CI ${CI_COMMIT_SHA} [SKIP CI]" --allow-empty
      - git push
      - cd ..
      - rm -rf $CI_REPO_NAME

      # Push to extra branch
      - git clone -b extra https://$${CBTOKEN}@codeberg.org/$CI_REPO.git $CI_REPO_NAME
      - cd $CI_REPO_NAME
      - git rm -r "*" || true
      - cp -ar ../repos/extra/. . || true
      - git add --all
      - git commit -m "Woodpecker CI ${CI_COMMIT_SHA} [SKIP CI]" --allow-empty
      - git push
      - cd ..
      - rm -rf $CI_REPO_NAME

    when:
      event: [push]