-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (121 loc) · 3.98 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Publish
on:
workflow_dispatch:
inputs:
tag:
description: The tag to publish
required: true
push:
tags: [ 'v*.*.*' ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- aarch64-linux-android # 64-bit ARM
#- armv7-linux-androideabi # 32-bit ARM
#- i686-linux-android # 32-bit x86
#- x86_64-linux-android # 64-bit x86
#- arm-linux-androideabi # 32-bit ARM (older ABI)
#- thumbv7neon-linux-androideabi # 32-bit ARM with NEON
name: Build Release - ${{ matrix.target }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Set version variable
run: |
version="${{ github.event.inputs.tag || github.ref }}"
version=${version#v}
echo "VERSION=$version" >> "$GITHUB_ENV"
echo "$version"
- name: Set arch variable
run: |
arch_alias() {
case $1 in
"aarch64-linux-android")
echo "aarch64"
;;
"i686-linux-android")
echo "i686"
;;
"x86_64-linux-android")
echo "x86_64"
;;
"arm-linux-androideabi")
echo "arm"
;;
*)
echo "Invalid architecture name"
;;
esac
}
arch=$(arch_alias ${{ matrix.target }})
echo "ARCH=$arch" >> "$GITHUB_ENV"
echo "$arch"
- name: Debug Environment Variables
run: |
echo "Version: $VERSION"
echo "Arch: $ARCH"
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Deps & Bins
uses: Swatinem/rust-cache@v2
- name: Install cross
shell: bash
run: |
if ! command -v cross &> /dev/null; then
echo "cross not found, installing..."
cargo install cross --git https://github.com/cross-rs/cross
else
echo "cross already installed, skipping installation."
fi
- name: Build - ${{ matrix.target }}
shell: bash
run: cross build --target=${{ matrix.target }} --release
- name: Install termux-create-package
run: pip3 install git+https://github.com/termux/termux-create-package
- name: Build Termux deb package
shell: bash
run: ./build_deb.sh -v $VERSION -a ${{ matrix.target }}
- name: Upload Termux deb package artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: ./deb/termux-clock_${{ env.VERSION }}_${{ env.ARCH }}.deb
publish:
name: Publish to GitHub Releases
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
strategy:
matrix:
target:
- aarch64-linux-android # 64-bit ARM
#- armv7-linux-androideabi # 32-bit ARM
#- i686-linux-android # 32-bit x86
#- x86_64-linux-android # 64-bit x86
#- arm-linux-androideabi # 32-bit ARM (older ABI)
#- thumbv7neon-linux-androideabi # 32-bit ARM with NEON
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.tag || github.ref }} # Ensure it checks out the correct tag
- name: Download Termux package artifact
uses: actions/download-artifact@v3
with:
name: ${{ matrix.target }}
- name: Publish release
uses: ghalactic/github-release-from-tag@v5
with:
generateReleaseNotes: true
assets: |
- path: termux-clock*.deb