Skip to content

Compile Packages

Compile Packages #80

Workflow file for this run

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 }}