Add Woodpecker CI setup guide for Gitea integration #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # DO NOT EDIT - This file is generated by cigen | |
| # Source: .cigen/workflows/ | |
| # Regenerate with: cargo run -- --config .cigen generate | |
| # | |
| name: RELEASE | |
| on: | |
| pull_request: {} | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| docker_image: | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| needs: | |
| - release_create | |
| env: | |
| DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
| DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - run: | | |
| VERSION=$(grep -E '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') | |
| echo "DOCKER_IMAGE_VERSION=$VERSION" >> "$GITHUB_ENV" | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| password: ${{ env.DOCKERHUB_TOKEN }} | |
| username: ${{ env.DOCKERHUB_USERNAME }} | |
| - name: Build and push multi-arch image | |
| run: | | |
| set -euo pipefail | |
| VERSION="${{ env.DOCKER_IMAGE_VERSION }}" | |
| echo "Building docspringcom/cigen:${VERSION} and :latest" | |
| docker buildx build \ | |
| --platform linux/amd64,linux/arm64 \ | |
| -f Dockerfile \ | |
| --build-arg CIGEN_VERSION="${VERSION}" \ | |
| -t docspringcom/cigen:"${VERSION}" \ | |
| -t docspringcom/cigen:latest \ | |
| --push . | |
| release_build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| name: cigen-macos-amd64 | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| name: cigen-macos-arm64 | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| name: cigen-linux-amd64 | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| name: cigen-linux-arm64 | |
| use-cross: true | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Prepare Node runtime for actions | |
| if: ${{ env.ACT == 'true' }} | |
| run: | | |
| set -e | |
| if ! command -v node >/dev/null 2>&1 || ! command -v protoc >/dev/null 2>&1; then | |
| apt-get update | |
| apt-get install -y nodejs npm protobuf-compiler | |
| fi | |
| - uses: actions/github-script@v7 | |
| with: | |
| script: |- | |
| const script = require('./.github/wait-for-checks.js'); | |
| await script({ github, context, core }); | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install Linux build dependencies | |
| run: | | |
| set -e | |
| sudo apt-get update | |
| sudo apt-get install -y protobuf-compiler | |
| - run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Build binary | |
| run: | | |
| set -e | |
| if [ "${{ matrix.use-cross }}" = "true" ]; then | |
| cross build --release --target ${{ matrix.target }} --bin cigen | |
| else | |
| cargo build --release --target ${{ matrix.target }} --bin cigen | |
| fi | |
| - name: Create archive | |
| run: | | |
| set -e | |
| cd "target/${{ matrix.target }}/release" | |
| tar czf "../../../${{ matrix.name }}.tar.gz" cigen | |
| cd ../../../ | |
| echo "ASSET_PATH=${{ matrix.name }}.tar.gz" >> "$GITHUB_ENV" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.name }} | |
| path: ${{ env.ASSET_PATH }} | |
| release_create: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - release_build | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Prepare Node runtime for actions | |
| if: ${{ env.ACT == 'true' }} | |
| run: | | |
| set -e | |
| if ! command -v node >/dev/null 2>&1 || ! command -v protoc >/dev/null 2>&1; then | |
| apt-get update | |
| apt-get install -y nodejs npm protobuf-compiler | |
| fi | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - run: | | |
| VERSION=$(grep -E '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') | |
| if [ "${{ github.event_name }}" = "push" ]; then | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| EXPECTED_TAG="v$VERSION" | |
| if [ "$TAG" != "$EXPECTED_TAG" ]; then | |
| echo "Error: Tag $TAG doesn't match expected $EXPECTED_TAG from Cargo.toml" >&2 | |
| exit 1 | |
| fi | |
| echo "RELEASE_TAG=$TAG" >> "$GITHUB_ENV" | |
| else | |
| echo "RELEASE_TAG=v$VERSION" >> "$GITHUB_ENV" | |
| fi | |
| echo "RELEASE_VERSION=$VERSION" >> "$GITHUB_ENV" | |
| - name: Generate checksums | |
| run: | | |
| set -e | |
| cd artifacts | |
| for dir in */; do | |
| cd "$dir" | |
| for file in *; do | |
| case "$file" in | |
| *.tar.gz|*.zip) | |
| if [ -f "$file" ]; then | |
| sha256sum "$file" > "${file}.sha256" || shasum -a 256 "$file" | awk '{print $1}' > "${file}.sha256" | |
| fi | |
| ;; | |
| esac | |
| done | |
| cd .. | |
| done | |
| cd .. | |
| - name: Generate changelog | |
| run: | | |
| cat > changelog.md <<EOF | |
| ## Installation | |
| ### One-liner (Linux/macOS) | |
| curl -fsSL https://docspring.github.io/cigen/install.sh | sh | |
| ### Direct downloads | |
| - macOS (Intel): https://github.com/${{ github.repository }}/releases/download/${{ env.RELEASE_TAG }}/cigen-macos-amd64.tar.gz | |
| - macOS (Apple Silicon): https://github.com/${{ github.repository }}/releases/download/${{ env.RELEASE_TAG }}/cigen-macos-arm64.tar.gz | |
| - Linux (x86_64): https://github.com/${{ github.repository }}/releases/download/${{ env.RELEASE_TAG }}/cigen-linux-amd64.tar.gz | |
| - Linux (ARM64): https://github.com/${{ github.repository }}/releases/download/${{ env.RELEASE_TAG }}/cigen-linux-arm64.tar.gz | |
| EOF | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| prerelease: ${{ contains(env.RELEASE_TAG, '-') }} | |
| body_path: changelog.md | |
| files: |- | |
| artifacts/**/*.tar.gz | |
| artifacts/**/*.sha256 | |
| name: CIGen v${{ env.RELEASE_VERSION }} | |
| draft: false | |
| tag_name: ${{ env.RELEASE_TAG }} |