Skip to content

Commit

Permalink
build: sign android release apk
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsNotGoodName committed Nov 2, 2023
1 parent b4662bd commit 11fc295
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ on:

jobs:
nightly:
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -25,6 +22,9 @@ jobs:
distribution: "temurin"
java-version: "17"

- name: Set up zipalign and apksigner
run: sudo apt install -y zipalign apksigner

- name: Set up Node
uses: actions/setup-node@v3
with:
Expand All @@ -47,10 +47,16 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build
env:
ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
run: task build

- name: Publish
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete nightly --yes || true
git push origin :nightly || true
gh release create --prerelease --title "Nightly" --notes "" --target $GITHUB_SHA nightly dist/artifacts/*
gh release create --prerelease --title "Nightly $(date +'%Y-%m-%d')" --notes "" --target $GITHUB_SHA nightly dist/artifacts/*
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ tooling-webrpc:
tooling-java:
$(info Please install Java 17.)

tooling-taskfile:
tooling-task:
go install github.com/go-task/task/v3/cmd/task@latest
29 changes: 19 additions & 10 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,29 @@ tasks:
cmds:
- mkdir -p dist
- chmod +x gradlew
- ./gradlew build
- ./gradlew assembleDebug
- cp app/build/outputs/apk/debug/app-debug.apk ../dist/radiomuxplayer-debug.apk
- ./gradlew :app:assembleRelease -x test
- rm {{.RELEASE_DIR}}/app-release-unsigned-aligned.apk || true
- zipalign -v -p 4 {{.RELEASE_DIR}}/app-release-unsigned.apk {{.RELEASE_DIR}}/app-release-unsigned-aligned.apk
- echo $ANDROID_KEYSTORE | base64 --decode > my-release-key.jks
- apksigner sign --ks my-release-key.jks --ks-pass env:ANDROID_KEYSTORE_PASSWORD --out {{.RELEASE_DIR}}/app-release.apk {{.RELEASE_DIR}}/app-release-unsigned-aligned.apk
- apksigner verify {{.RELEASE_DIR}}/app-release.apk
- cp {{.RELEASE_DIR}}/app-release.apk ../dist/radiomuxplayer-release.apk
vars:
RELEASE_DIR: app/build/outputs/apk/release
env:
ANDROID_KEYSTORE:
ANDROID_KEYSTORE_PASSWORD:

build-server:
internal: true
cmds:
- go mod tidy
- go generate ./...
- GOOS=linux GOARCH=amd64 go build -ldflags="{{.LDFLAGS}}" -o ./dist/radiomux_Linux_x86_64 {{.MAIN}}
- GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="{{.LDFLAGS}}" -o ./dist/radiomux_Linux_armv7 {{.MAIN}}
- GOOS=linux GOARCH=arm64 go build -ldflags="{{.LDFLAGS}}" -o ./dist/radiomux_Linux_arm64 {{.MAIN}}
- GOOS=darwin GOARCH=arm64 go build -ldflags="{{.LDFLAGS}}" -o ./dist/radiomux_Darwin_arm64 {{.MAIN}}
- GOOS=windows GOARCH=amd64 go build -ldflags="{{.LDFLAGS}}" -o ./dist/radiomux_Windows_x86_64.exe {{.MAIN}}
- GOOS=linux GOARCH=amd64 go build -ldflags="{{.LDFLAGS}}" -o ./dist/radiomux_Linux_x86_64 {{.MAIN_PACKAGE}}
- GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="{{.LDFLAGS}}" -o ./dist/radiomux_Linux_armv7 {{.MAIN_PACKAGE}}
- GOOS=linux GOARCH=arm64 go build -ldflags="{{.LDFLAGS}}" -o ./dist/radiomux_Linux_arm64 {{.MAIN_PACKAGE}}
- GOOS=darwin GOARCH=arm64 go build -ldflags="{{.LDFLAGS}}" -o ./dist/radiomux_Darwin_arm64 {{.MAIN_PACKAGE}}
- GOOS=windows GOARCH=amd64 go build -ldflags="{{.LDFLAGS}}" -o ./dist/radiomux_Windows_x86_64.exe {{.MAIN_PACKAGE}}
env:
CGO_ENABLED: 0
vars:
Expand All @@ -42,7 +51,7 @@ tasks:
BUILD_REPO_URL: "https://{{.PACKAGE_NAME}}"

LDFLAGS: -s -w -X {{.BUILD_PACKAGE_NAME}}.Version={{.BUILD_VERSION}} -X {{.BUILD_PACKAGE_NAME}}.Commit={{.BUILD_COMMIT}} -X {{.BUILD_PACKAGE_NAME}}.Date={{.BUILD_DATE}} -X {{.BUILD_PACKAGE_NAME}}.RepoURL={{.BUILD_REPO_URL}}
MAIN: "{{.PACKAGE_NAME}}/cmd/radiomux"
MAIN_PACKAGE: "{{.PACKAGE_NAME}}/cmd/radiomux"

checksum:
internal: true
Expand All @@ -57,7 +66,7 @@ tasks:
- for: { var: FILES }
cmd: cp ../{{.ITEM}} .
- mkdir -p artifacts
- cp radiomuxplayer-debug.apk artifacts/
- cp radiomuxplayer-release.apk artifacts/
- tar -czf artifacts/radiomux_Linux_x86_64.tar.gz radiomux_Linux_x86_64 {{.FILES}}
- tar -czf artifacts/radiomux_Linux_armv7.tar.gz radiomux_Linux_armv7 {{.FILES}}
- tar -czf artifacts/radiomux_Linux_arm64.tar.gz radiomux_Linux_arm64 {{.FILES}}
Expand Down

0 comments on commit 11fc295

Please sign in to comment.