Skip to content

Commit

Permalink
add release pipeline (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
peanut996 authored Dec 23, 2024
1 parent eb1ea8f commit 4b8ecc7
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 66 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Android
on:
push:
branches: [ "*", "*/*" ]
tags:
- 'v*'
pull_request:
branches: [ "*", "*/*" ]

Expand Down
127 changes: 127 additions & 0 deletions .github/workflows/release-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Release All Platforms

on:
push:
tags:
- 'v*'

permissions:
contents: write
packages: write

jobs:
go-releases:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [386, amd64, arm64]
include:
- goos: linux
goarch: arm
goarm: 7
- goos: linux
goarch: mips
gomips: softfloat
- goos: linux
goarch: mipsle
gomips: softfloat
- goos: linux
goarch: mips64
- goos: linux
goarch: mips64le
exclude:
- goos: darwin
goarch: arm
- goos: darwin
goarch: 386
steps:
- uses: actions/checkout@v4

- name: Set APP_VERSION env
run: echo APP_VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV}

- name: Set ldflags as environment variable
run: |
if [ ${{ matrix.goos }} == 'linux' ]&&[ ${{ matrix.goarch }} == 'amd64' ]; then
LD_FLAGS="-X main.Version=${{ env.APP_VERSION }} -linkmode 'external' -extldflags '-static'"
else
LD_FLAGS="-X main.Version=${{ env.APP_VERSION }}"
fi
echo "LD_FLAGS=$LD_FLAGS" >> ${GITHUB_ENV}
- uses: pdahd/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goarm: ${{ matrix.goarm }}
gomips: ${{ matrix.gomips }}
project_path: "."
binary_name: "CloudflareWarpSpeedTest"
goversion: "1.22"
ldflags: "${{ env.LD_FLAGS }}"

android-release:
name: Release Android APK
runs-on: ubuntu-latest
needs: go-releases
steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x android/gradlew

- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
sdk-platform: '34'
build-tools: '34.0.0'

- name: Build Release APK
working-directory: ./android
run: ./gradlew assembleRelease

- name: Sign Release APK
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: android/app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"

- name: Rename APK with Version
run: |
VERSION=${GITHUB_REF#refs/tags/}
mv ${{ env.SIGNED_RELEASE_FILE }} android/app/build/outputs/apk/release/CloudflareWarpSpeedTest-${VERSION}.apk
echo "RELEASE_APK=android/app/build/outputs/apk/release/CloudflareWarpSpeedTest-${VERSION}.apk" >> $GITHUB_ENV
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
${{ env.RELEASE_APK }}
draft: false
prerelease: false
generate_release_notes: true
64 changes: 0 additions & 64 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit 4b8ecc7

Please sign in to comment.