summaryrefslogtreecommitdiffstats
path: root/.woodpecker/deploy.yml
blob: 18f88e489e40bd96e0ce38749b3ceb7ae3c48ba6 (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
when:
  - event: tag
steps:
  compile-linux:
    image: rust:latest
    commands:
      - rustup target add x86_64-unknown-linux-gnu
      - cargo build --target=x86_64-unknown-linux-gnu --release --features update-check
      - strip target/x86_64-unknown-linux-gnu/release/fj
    secrets: [ client_info_codeberg ]
  compile-windows:
    image: rust:latest
    commands:
      - rustup target add x86_64-pc-windows-gnu
      - apt update
      - apt install gcc-mingw-w64-x86-64 -y
      - cargo build --target=x86_64-pc-windows-gnu --release --features update-check
      - strip target/x86_64-pc-windows-gnu/release/fj.exe
    secrets: [ client_info_codeberg ]
  zip:
    image: debian:12
    commands:
      - apt update
      - apt install zip -y
      - cd target/x86_64-pc-windows-gnu/release
      - zip ../../../forgejo-cli-windows.zip fj.exe
      - cd ../../..
      - gzip -c target/x86_64-unknown-linux-gnu/release/fj > forgejo-cli-linux.gz
  deploy-container:
    image: gcr.io/kaniko-project/executor:debug
    commands:
      - export FORGE_HOST=$(echo $CI_FORGE_URL | sed -E 's_^https?://__')
      - export AUTH="$(echo -n $CI_REPO_OWNER:$TOKEN | base64)"
      - echo "{\"auths\":{\"$FORGE_HOST\":{\"auth\":\"$AUTH\"}}}" > "/kaniko/.docker/config.json"
      - export CONTAINER_OWNER=$(echo $CI_REPO_OWNER | awk '{print tolower($0)}')
      - executor --context ./ --dockerfile ./Dockerfile --destination "$FORGE_HOST/$CONTAINER_OWNER/forgejo-cli:latest" 
    secrets: [ token ]
  release:
    image: codeberg.org/cyborus/forgejo-cli:latest
    pull: true
    commands:
      - export FORGE_HOST=$(echo $CI_FORGE_URL | sed -E 's_^https?://__')
      - fj auth add-key $FORGE_HOST $CI_REPO_OWNER $TOKEN
      - fj release --repo $CI_REPO_URL asset create $CI_COMMIT_TAG forgejo-cli-windows.zip
      - fj release --repo $CI_REPO_URL asset create $CI_COMMIT_TAG forgejo-cli-linux.gz
      - fj auth logout $FORGE_HOST
    secrets: [ token ]