apache / apache/infrastructure-actions

Automation of Branch Names for a Simple Standard Build Workflow

Open
#45 5 comments 0 reactions 0 assignees View on GitHub
pelican
Dominant language
Python
Stars
30
Forks
83
Avg merge
2d 18h
Merged PRs (30d)
79

Description

It should be possible to create and use a standard workflow that automatically takes into account the branch name and our convention about the output brand a prototype is here: https://github.com/apache/petri/blob/dfoulks/pelican-gha/.github/workflows/build-pelican.yml

Note that the following part covers the automation of changes on branches:

```
on:
push:
branches:
- 'preview/**'
pull_request:
branches:
- 'preview/**'
workflow_dispatch:
```

We might need an excludes.

The other part computes the branch names and should become part of our standard action:

```
jobs:
build-pelican:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.head_ref || github.ref }}
- name: Determine branch name
id: get_branch
run: |
# Get the current branch name
echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
- name: Branch
run: |
echo "Branch: ${{ env.BRANCH_NAME }}"
if [ "${{ env.BRANCH_NAME }}" == "${{ github.event.repository.default_branch }}" ]; then
echo "OUTPUT_BRANCH=asf-site" >> $GITHUB_ENV
else
echo "OUTPUT_BRANCH=${{ env.BRANCH_NAME }}-staging" >> $GITHUB_ENV
fi
- name: Pelican Build
uses: apache/infrastructure-actions/pelican@main
with:
destination: ${{ env.OUTPUT_BRANCH }}
```

Making the destination part of the automation means that the pelican action should babe able to need no inputs.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.