forked from cloudflare/cloudflared
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
364e0c1
commit bae0685
Showing
1 changed file
with
64 additions
and
253 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,262 +1,73 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
name: Build-cloudflared | ||
|
||
name: Update-cloudflared | ||
|
||
# Controls when the workflow will run | ||
on: | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
push: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
check-update: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- goos: linux | ||
goarch: aarch64 | ||
gomips: softfloat | ||
goarm: "" | ||
env: aarch64_cortex-a53 | ||
- goos: linux | ||
goarch: aarch64 | ||
gomips: softfloat | ||
goarm: "" | ||
env: aarch64_cortex-a72 | ||
- goos: linux | ||
goarch: aarch64 | ||
gomips: softfloat | ||
goarm: "" | ||
env: aarch64_generic | ||
- goos: linux | ||
goarch: arc | ||
gomips: "" | ||
goarm: "" | ||
env: arc_archs | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 6 | ||
env: arm_arm1176jzf-s_vfp | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 926ej-s | ||
env: arm_arm926ej-s | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 7 | ||
env: arm_cortex-a15_neon-vfpv4 | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 5 | ||
env: arm_cortex-a5_vfpv4 | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 7 | ||
env: arm_cortex-a7 | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 7 | ||
env: arm_cortex-a7_neon-vfpv4 | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 7 | ||
env: arm_cortex-a7_vfpv4 | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 8 | ||
env: arm_cortex-a8_vfpv3 | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 9 | ||
env: arm_cortex-a9 | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 9 | ||
env: arm_cortex-a9_neon | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 9 | ||
env: arm_cortex-a9_vfpv3-d16 | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 5 | ||
env: arm_fa526 | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 4 | ||
env: arm_mpcore | ||
- goos: linux | ||
goarch: arm | ||
gomips: "" | ||
goarm: 5 | ||
env: arm_xscale | ||
- goos: linux | ||
goarch: i386 | ||
gomips: "" | ||
goarm: "" | ||
env: i386_pentium-mmx | ||
- goos: linux | ||
goarch: i386 | ||
gomips: "" | ||
goarm: "" | ||
env: i386_pentium4 | ||
- goos: linux | ||
goarch: mips64 | ||
gomips: "" | ||
goarm: "" | ||
env: mips64_octeonplus | ||
- goos: linux | ||
goarch: mips | ||
gomips: 24kc | ||
goarm: "" | ||
env: mips_24kc | ||
- goos: linux | ||
goarch: mips | ||
gomips: 4kec | ||
goarm: "" | ||
env: mips_4kec | ||
- goos: linux | ||
goarch: mips | ||
gomips: mips32 | ||
goarm: "" | ||
env: mips_mips32 | ||
- goos: linux | ||
goarch: mipsle | ||
gomips: 24kc | ||
goarm: "" | ||
env: mipsel_24kc | ||
- goos: linux | ||
goarch: mipsle | ||
gomips: 24kf | ||
goarm: "" | ||
env: mipsel_24kc_24kf | ||
- goos: linux | ||
goarch: mipsle | ||
gomips: 74kc | ||
goarm: "" | ||
env: mipsel_74kc | ||
- goos: linux | ||
goarch: mipsle | ||
gomips: mips32 | ||
goarm: "" | ||
env: mipsel_mips32 | ||
- goos: linux | ||
goarch: ppc64 | ||
gomips: "" | ||
goarm: "" | ||
env: powerpc_464fp | ||
- goos: linux | ||
goarch: ppc | ||
gomips: "" | ||
goarm: "" | ||
env: powerpc_8540 | ||
- goos: linux | ||
goarch: amd64 | ||
gomips: "" | ||
goarm: "" | ||
env: x86_64 | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Checkout new tags to branches | ||
id: checkout-tags | ||
uses: chachako/checkout-tags@v1 | ||
with: | ||
base: cloudflare/cloudflared | ||
token: ${{ github.token }} | ||
overwrite: false | ||
|
||
# Cache Go dependencies | ||
- name: Cache Go modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
# Get the last commit ID of cloudflare/go | ||
- name: Get last commit ID of cloudflare/go | ||
id: get_commit_id | ||
run: | | ||
git clone https://github.com/cloudflare/go --depth 1 | ||
commit_id=$(git -C go rev-parse HEAD) | ||
echo "::set-output name=commit_id::$commit_id" | ||
# Cache cf-go build result | ||
- name: Cache cf-go build | ||
uses: actions/cache@v3 | ||
with: | ||
path: go/bin | ||
key: ${{ runner.os }}-cf-go-${{ steps.get_commit_id.outputs.commit_id }} | ||
restore-keys: | | ||
${{ runner.os }}-cf-go- | ||
- name: Build cf-go | ||
if: ${{ steps.checkout-tags.outputs.up-to-date && steps.cache-cf-go-build.outputs.cache-hit != 'true' }} | ||
run: | | ||
cd go/src | ||
./make.bash | ||
chmod +x ../bin/go | ||
- name: Build cloudflared | ||
if: ${{ steps.checkout-tags.outputs.up-to-date }} | ||
run: | | ||
cd /home/runner/work/cloudflared/cloudflared | ||
git clone https://github.com/cloudflare/cloudflared --depth 1 | ||
cd cloudflared/cmd/cloudflared | ||
CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} GOMIPS=${{ matrix.gomips }} GOARM=${{ matrix.goarm }} /home/runner/work/cloudflared/cloudflared/go/bin/go build -a -trimpath -installsuffix cgo -ldflags '-s -w -extldflags "-static"' . | ||
mv cloudflared cloudflared_${{ matrix.env }} | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cloudflared | ||
path: /home/runner/work/cloudflared/cloudflared/cloudflared/cmd/cloudflared/cloudflared_* | ||
# The level of compression for Zlib to be applied to the artifact archive. | ||
# The value can range from 0 to 9. | ||
# For large files that are not easily compressed, a value of 0 is recommended for significantly faster uploads. | ||
# Optional. Default is '6' | ||
compression-level: 0 | ||
|
||
- name: Get latest tag | ||
id: latest_tag | ||
uses: anothrNick/github-tag-action@1.35.0 | ||
env: | ||
DEFAULT_BUMP: patch | ||
WITH_V: true | ||
DEFAULT_BRANCH: main | ||
RELEASE_BRANCHES: main | ||
GITHUB_TOKEN: ${{ github.token }} | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
if: steps.latest_tag.outputs.new_tag | ||
with: | ||
make_latest: "true" | ||
tag_name: ${{ steps.latest_tag.outputs.new_tag }} | ||
files: /home/runner/work/cloudflared/cloudflared/cloudflared/cmd/cloudflared/cloudflared | ||
token: ${{ github.token }} | ||
fail_on_unmatched_files: false | ||
|
||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
repository: 'cloudflare/cloudflared' | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
|
||
- name: Cache Go modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Build | ||
run: | | ||
export GOARCH="" | ||
export GOOS="linux" | ||
for ARCH in aarch64_cortex-a53 aarch64_cortex-a72 aarch64_generic arc_archs arm_arm1176jzf-s_vfp arm_arm926ej-s arm_cortex-a15_neon-vfpv4 arm_cortex-a5_vfpv4 arm_cortex-a7 arm_cortex-a7_neon-vfpv4 arm_cortex-a7_vfpv4 arm_cortex-a8_vfpv3 arm_cortex-a9 arm_cortex-a9_neon arm_cortex-a9_vfpv3-d16 arm_fa526 arm_mpcore arm_xscale i386_pentium-mmx i386_pentium4 mips64_octeonplus mips_24kc mips_4kec mips_mips32 mipsel_24kc mipsel_24kc_24kf mipsel_74kc mipsel_mips32 powerpc_464fp powerpc_8540 x86_64 | ||
do | ||
export GOARCH=$ARCH | ||
go build -trimpath -ldflags "-s -w" ./cmd/cloudflared | ||
zip cloudflared-$ARCH.zip cloudflared | ||
done | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: cloudflared-binaries | ||
path: ./*.zip | ||
|
||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: cloudflared-binaries | ||
|
||
- name: Get latest tag | ||
id: latest_tag | ||
uses: anothrNick/github-tag-action@1.35.0 | ||
env: | ||
DEFAULT_BUMP: patch | ||
WITH_V: true | ||
DEFAULT_BRANCH: main | ||
RELEASE_BRANCHES: main | ||
GITHUB_TOKEN: ${{ github.token }} | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
if: steps.latest_tag.outputs.new_tag | ||
with: | ||
tag_name: ${{ steps.latest_tag.outputs.new_tag }} | ||
files: ./*.zip | ||
token: ${{ github.token }} | ||
fail_on_unmatched_files: false |