feat: build for android

This commit is contained in:
Jan De Dobbeleer 2023-07-10 08:08:24 +02:00 committed by Jan De Dobbeleer
parent bce149b82f
commit 7d5c731d2f
2 changed files with 38 additions and 0 deletions

36
.github/workflows/android.yml vendored Normal file
View file

@ -0,0 +1,36 @@
name: Android
on:
release:
types: [published]
jobs:
build-android:
runs-on: ubuntu-latest
container: ghcr.io/jandedobbeleer/golang-android-container:latest
steps:
- name: Checkout code 👋
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Build
run: |
VERSION="${${{ github.event.release.name }}:1}"
echo "Building version ${VERSION}"
cd src
go build -o dist/posh-android-arm -ldflags="-s -w -X 'github.com/jandedobbeleer/oh-my-posh/src/build.Version=${VERSION}' -X 'github.com/jandedobbeleer/oh-my-posh/src/build.Date=$(date)'"
- name: Upload artifacts 🆙
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
console.log('environment', process.versions);
const fs = require('fs').promises;
const { repo: { owner, repo }, sha } = context;
console.log({ owner, repo, sha });
await github.rest.repos.uploadReleaseAsset({
owner, repo,
release_id: ${{ github.event.release.id }},
name: 'posh-android-arm',
data: await fs.readFile('./src/dist/posh-android-arm')
});

View file

@ -138,6 +138,8 @@ func (oi *Os) getDistroIcon(distro string) string {
return oi.props.GetString(Slackware, "\uF319")
case "ubuntu":
return oi.props.GetString(Ubuntu, "\uF31b")
case "android":
return oi.props.GetString(Ubuntu, "\uf17b")
}
return oi.props.GetString(Linux, "\uF17C")
}