Skip to content

Commit eb015c6

Browse files
committed
Add GH Action to produce direct links to download example subprojects
1 parent 4fd5602 commit eb015c6

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Archive Example Projects
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- 'examples/android-example/**'
9+
- 'examples/kotlin-dataframe-plugin-example/**'
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-archives:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Create android-example archive
21+
run: |
22+
cd examples/android-example
23+
zip -r ../../android-example.zip . -x "*.git*" "build/*" ".gradle/*" "*/build/*"
24+
25+
- name: Create kotlin-dataframe-plugin-example archive
26+
run: |
27+
cd examples/kotlin-dataframe-plugin-example
28+
zip -r ../../kotlin-dataframe-plugin-example.zip . -x "*.git*" "build/*" ".gradle/*" "*/build/*"
29+
30+
- name: Checkout example-projects-archives branch
31+
run: |
32+
git config user.name "github-actions[bot]"
33+
git config user.email "github-actions[bot]@users.noreply.github.com"
34+
35+
if git ls-remote --exit-code --heads origin example-projects-archives; then
36+
git fetch origin example-projects-archives
37+
git checkout example-projects-archives
38+
else
39+
git checkout --orphan example-projects-archives
40+
git rm -rf .
41+
fi
42+
43+
- name: Update archives
44+
run: |
45+
git rm -f *.zip 2>/dev/null || true
46+
47+
mv android-example.zip .
48+
mv kotlin-dataframe-plugin-example.zip .
49+
50+
cat > README.md << 'EOF'
51+
# Kotlin DataFrame - Example Projects Archives
52+
53+
Automatically generated archives of example projects.
54+
55+
## Available archives:
56+
57+
### Android Example
58+
Example of using Kotlin DataFrame in an Android application.
59+
60+
**Download:** [android-example.zip](https://github.com/Kotlin/dataframe/raw/example-projects-archives/android-example.zip)
61+
62+
### Kotlin DataFrame Plugin Example
63+
Example of using the compiler plugin for Kotlin DataFrame.
64+
65+
**Download:** [kotlin-dataframe-plugin-example.zip](https://github.com/Kotlin/dataframe/raw/example-projects-archives/kotlin-dataframe-plugin-example.zip)
66+
67+
---
68+
69+
Last updated: $(date -u '+%Y-%m-%d %H:%M:%S UTC')
70+
71+
Source commit: ${{ github.sha }}
72+
EOF
73+
74+
git add .
75+
git commit -m "Update example archives from ${{ github.sha }}" || echo "No changes to commit"
76+
77+
- name: Push to example-projects-archives branch
78+
run: |
79+
git push -f origin example-projects-archives
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)