forked from moritz-wundke/Boost-for-Android
-
Notifications
You must be signed in to change notification settings - Fork 42
112 lines (95 loc) · 3.46 KB
/
ci.yaml
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
name: Release Asset Check
on:
workflow_dispatch:
inputs:
tagName:
description: 'Tag Name to Process (leave empty for latest)'
required: false
default: ''
release:
types: [created, published]
jobs:
check-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install GitHub CLI
run: |
if ! command -v gh &> /dev/null
then
echo "GitHub CLI not found, installing..."
sudo apt update
sudo apt install -y gh
else
echo "GitHub CLI is already installed."
fi
gh --version
- name: Determine the Tag Name
id: get-tag-name
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.tagName }}" != "" ]]; then
echo "Using manually provided tag name: ${{ github.event.inputs.tagName }}"
echo "tag_name=${{ github.event.inputs.tagName }}" >> $GITHUB_ENV
else
echo "Determining the latest release tag..."
release_info=$(gh release view --json tagName -q .tagName)
echo "tag_name=$release_info" >> $GITHUB_ENV
fi
- name: Download the release asset
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Read the tag name from the environment variable
asset_name="${{ env.tag_name }}.zip"
echo "Looking for asset: $asset_name"
# Use GitHub CLI to download the asset
gh release download "${{ env.tag_name }}" \
--pattern "$asset_name" \
--dir .
- name: Extract the archive
run: |
asset_name="${{ env.tag_name }}.zip"
unzip "$asset_name" -d extracted
- name: Check for the expected directory structure
# extracted/{release_name}
# include
# boost/
# libs
# arm64-v8a/
# armeabi-v7a/
# x86/
# x86_64/
run: |
# Expected root directory inside the extracted folder
expected_dir="extracted/${{ env.tag_name }}"
echo "Checking for directory: $expected_dir"
# Check if the extracted root directory exists
if [ ! -d "$expected_dir" ]; then
echo "Directory $expected_dir does not exist."
exit 1
fi
# Check for the 'include' directory with the 'boost' subdirectory
if [ ! -d "$expected_dir/include/boost" ]; then
echo "Directory $expected_dir/include/boost does not exist."
exit 1
fi
# Check for the 'libs' directory with expected architecture subdirectories
for arch in arm64-v8a armeabi-v7a x86 x86_64; do
if [ ! -d "$expected_dir/libs/$arch" ]; then
echo "Directory $expected_dir/libs/$arch does not exist."
exit 1
fi
done
echo "All specified directories exist."
# - name: Check for the specific file
# run: |
# # Update this path to the expected location of your file within the extracted directory
# if [ -f "extracted/path/to/your/file" ]; then
# echo "File exists."
# else
# echo "File does not exist."
# exit 1
# fi