| 1 |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 2 |
|
| 3 |
name: Build |
| 4 |
|
| 5 |
on: [push, pull_request] |
| 6 |
|
| 7 |
jobs: |
| 8 |
build: |
| 9 |
runs-on: ubuntu-latest |
| 10 |
|
| 11 |
steps: |
| 12 |
- name: Fetch |
| 13 |
uses: actions/checkout@v4 |
| 14 |
- name: Unshallow |
| 15 |
run: git fetch --prune --unshallow --tags --force |
| 16 |
- name: Set up Python |
| 17 |
uses: actions/setup-python@v5 |
| 18 |
with: |
| 19 |
python-version: 3.9 |
| 20 |
- name: Install dependencies |
| 21 |
run: | |
| 22 |
sudo apt-get install -y pandoc |
| 23 |
python -m pip install --upgrade pip |
| 24 |
python -m pip install -r requirements.txt |
| 25 |
- name: Build |
| 26 |
run: | |
| 27 |
make -j -B dist |
| 28 |
- name: Upload artifacts |
| 29 |
if: github.ref_type == 'tag' |
| 30 |
uses: actions/upload-artifact@v4 |
| 31 |
with: |
| 32 |
name: dist |
| 33 |
path: Amiri-*.zip |
| 34 |
if-no-files-found: error |
| 35 |
|
| 36 |
deploy: |
| 37 |
if: github.ref_type == 'tag' |
| 38 |
needs: build |
| 39 |
runs-on: ubuntu-latest |
| 40 |
|
| 41 |
steps: |
| 42 |
- uses: actions/checkout@v4 |
| 43 |
|
| 44 |
- name: Download artifacts |
| 45 |
uses: actions/download-artifact@v4 |
| 46 |
with: |
| 47 |
path: dist |
| 48 |
|
| 49 |
- name: Extract release notes from annotated tag message |
| 50 |
run: | |
| 51 |
# GH checkout action doesn't preserve tag annotations, we must fetch them |
| 52 |
# https://github.com/actions/checkout/issues/290 |
| 53 |
git fetch --tags --force |
| 54 |
echo "$(git tag -l --format='%(contents:body)' ${{ github.ref_name }})" > "${{ runner.temp }}/release_body.md" |
| 55 |
echo "release_name=$(git tag -l --format='%(contents:subject)' ${{ github.ref_name }})" >> $GITHUB_ENV |
| 56 |
|
| 57 |
- name: Publish |
| 58 |
uses: softprops/action-gh-release@v2 |
| 59 |
with: |
| 60 |
name: ${{ env.release_name }} |
| 61 |
body_path: ${{ runner.temp }}/release_body.md |
| 62 |
fail_on_unmatched_files: true |
| 63 |
files: | |
| 64 |
dist/*/* |