-
Notifications
You must be signed in to change notification settings - Fork 46
75 lines (65 loc) · 2.14 KB
/
build.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
name: Compile Packages
on:
schedule:
- cron: '47 7 * * THU' # Run at 7:47 (5:47pm local) on Thursday
create:
ref_type: 'tag'
workflow_dispatch:
# Allow triggering manually whenever it's useful.
inputs:
source:
description: 'Branch/Tag'
required: true
default: 'dev'
type: string
permissions:
contents: read
pull-requests: read
jobs:
build:
runs-on: ubuntu-latest
steps:
# Use the tag if created there, dev each week, or what's specified when done manually.
- name: Checkout tag
if: github.event_name == 'create'
uses: actions/checkout@v4
with:
ref: ${{ github.event.ref }}
- name: Checkout dev
if: github.event_name == 'schedule'
uses: actions/checkout@v4
with:
ref: 'dev'
- name: Checkout reference
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ inputs.source }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: 'pip'
cache-dependency-path: 'requirements.txt'
- name: Install dependencies
run: python -m pip install -r requirements.txt pypyp
- name: Build Packages
run: python compile_packages.py --confirm --overwrite --zip "" "packages/"
- name: Calc Name (tag)
if: github.event_name == 'create'
# Strip folders from ref names, / isn't valid in a filename.
run: |
pyp "f'ARTI_NAME=beemod2_{re.sub('[^a-zA-Z0-9]+', '', Path('${{ github.event.ref }}').stem}_packages')" >> "$GITHUB_ENV"
echo "RETENTION=30" >> "$GITHUB_ENV"
- name: Calc Name (hash)
if: github.event_name != 'create'
run: |
pyp "f'ARTI_NAME=beemod2_dev{'${{ github.sha }}'[:8]}_packages'" >> "$GITHUB_ENV"
echo "RETENTION=8" >> "$GITHUB_ENV"
- name: Packages upload
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTI_NAME }}
path: ./zips/
if-no-files-found: error
retention-days: ${{ env.RETENTION }}