Version updated to: 2025.9.1 #41
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
| name: Build Cloudflared | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - 'main' | |
| paths: | |
| - 'version' | |
| concurrency: | |
| group: build | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 360 | |
| permissions: | |
| contents: write | |
| id-token: write | |
| attestations: write | |
| env: | |
| GOOS: linux | |
| GOARCH: arm | |
| GOARM: 6 | |
| CGO_ENABLED: 0 | |
| CC: arm-linux-gnueabi-gcc | |
| BUILD_ID: ${{ github.run_number }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Export version to variable | |
| shell: bash | |
| run: | | |
| if [ ! -f version ]; then | |
| echo "version file not found." | |
| exit 1 | |
| fi | |
| echo "CLOUDFLARED_VERSION=$(cat version)" >> $GITHUB_ENV | |
| - name: Checkout Cloudflared | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: cloudflare/cloudflared | |
| path: cloudflared | |
| ref: ${{ env.CLOUDFLARED_VERSION }} | |
| fetch-depth: 1 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'cloudflared/go.mod' | |
| cache-dependency-path: 'cloudflared/go.sum' | |
| - name: Install dependencies | |
| shell: bash | |
| run: | | |
| sudo apt update | |
| sudo apt install -y build-essential gcc-arm-linux-gnueabi libdigest-sha-perl | |
| gem install fpm | |
| - name: Build | |
| shell: bash | |
| working-directory: cloudflared | |
| run: | | |
| ARTIFACT_DIR=built_artifacts/ | |
| mkdir -p $ARTIFACT_DIR | |
| # rpm packages invert the - and _ | |
| RPMVERSION=$(echo $VERSION|sed -r 's/-/_/g') | |
| make cloudflared-rpm | |
| mv cloudflared-$RPMVERSION-1.arm.rpm $ARTIFACT_DIR/cloudflared.rpm | |
| # deb packages | |
| make cloudflared-deb | |
| mv cloudflared\_$VERSION\_arm.deb $ARTIFACT_DIR/cloudflared.deb | |
| # linux binary | |
| mv cloudflared $ARTIFACT_DIR/cloudflared | |
| env: | |
| TARGET_ARCH: arm | |
| TARGET_ARM: 6 | |
| VERSION: ${{ env.CLOUDFLARED_VERSION }} | |
| - name: Calculate SHA256 checksum | |
| working-directory: cloudflared/built_artifacts | |
| shell: bash | |
| run: | | |
| shasum -a 256 -b cloudflared* > .checksum.txt | |
| cat .checksum.txt | |
| - name: Generate artifact attestation | |
| id: attest | |
| uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-checksums: cloudflared/built_artifacts/.checksum.txt | |
| - name: Create release notes | |
| working-directory: cloudflared/built_artifacts | |
| shell: bash | |
| run: | | |
| cat << EOF > .release-notes.md | |
| Verify the release artifacts are built from source by Github by using the [Github CLI] to [verify] the integrity and provenance using its associated cryptographically [signed attestations] | |
| $(for filename in cloudflared*; do | |
| cat << ATTEST_EOF | |
| \`\`\`sh | |
| gh attestation verify $filename -R $GITHUB_REPOSITORY | |
| \`\`\` | |
| ATTEST_EOF | |
| done) | |
| SHA256 Checksums: | |
| \`\`\` | |
| $(cat .checksum.txt) | |
| \`\`\` | |
| [Github CLI]: https://cli.github.com/ | |
| [verify]: https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds | |
| [signed attestations]: ${{ steps.attest.outputs.attestation-url }} | |
| EOF | |
| - name: Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| name: ${{ env.CLOUDFLARED_VERSION }}-${{ env.BUILD_ID }} | |
| draft: false | |
| prerelease: false | |
| tag: ${{ env.CLOUDFLARED_VERSION }}-${{ env.BUILD_ID }} | |
| makeLatest: true | |
| bodyFile: 'cloudflared/built_artifacts/.release-notes.md' | |
| artifacts: 'cloudflared/built_artifacts/cloudflared*' |