Skip to content

Merge pull request #2 from tud-cs/refactor-yaml-structure #3

Merge pull request #2 from tud-cs/refactor-yaml-structure

Merge pull request #2 from tud-cs/refactor-yaml-structure #3

Workflow file for this run

name: Build release
on:
push:
branches:
- main
permissions:
contents: write
actions: read
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate HTML site and README.md
run: |
python3 -m venv .venv
source .venv/bin/activate
pip3 install lxml
pip3 install PyYAML
python3 check_keys.py
python3 init_site.py
python3 init_readme.py
- name: Package artifacts
run: tar -czf package.tar.gz ./website/images ./website/index.html ./website/filter.js ./website/styles.css
- name: Push README.md
run: |
set -e
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
set +e
git diff --exit-code README.md
# Check if the file has changed. If not, we won't be able to commit it and therefore early return here.
exitCode="$?"
if [ $exitCode -eq 0 ]; then
exit 0
fi
set -e
git add README.md
git commit -m "Update README.md"
git push
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Generate a unique tag name based on branch name and run number
TAG_NAME="release-${{ github.ref_name }}-${{ github.run_number }}"
# Create the tag locally
git tag $TAG_NAME
# Push the tag to the remote repository
git push origin $TAG_NAME
PACKAGE_NAME="package-${{ github.ref_name }}-${{ github.run_number }}.tar.gz"
cp package.tar.gz $PACKAGE_NAME
echo "Creating GitHub Release"
gh release create $TAG_NAME package.tar.gz --title "$TAG_NAME" --notes "Automated release from GitHub Actions"