Update main.yml #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Apps List | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
generate-apps-list: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Install jq | |
run: sudo apt-get install jq -y | |
- name: Read ABOUT.md | |
id: about | |
run: echo ::set-output name=content::$(cat ABOUT.md) | |
- name: Generate Apps List | |
id: generate-apps-list | |
run: | | |
new_content="${{ steps.about.outputs.content }}" | |
new_content+="| App Name | Image | Tag | Description |" | |
for app_folder in Apps/*; do | |
if [ -f "$app_folder/app.json" ]; then | |
app_data=$(cat "$app_folder/app.json") | |
app_name=$(echo "$app_data" | jq -r .app) | |
app_description=$(echo "$app_data" | jq -r .description) | |
app_image=$(echo "$app_data" | jq -r .image) | |
app_tag=$(echo "$app_data" | jq -r .tag) | |
# Add app information with proper line breaks | |
new_content+="\n| $app_name | $app_image | $app_tag | $app_description |" | |
fi | |
done | |
echo "::set-output name=content::${new_content}" | |
- name: Write Merged Content to README.md | |
run: | | |
readme_content="${{ steps.generate-apps-list.outputs.content }}" | |
echo "${readme_content}" > README.md | |
- name: Commit and Push Changes | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "actions@github.com" | |
git add README.md | |
git commit -m "Update README.md with apps list" | |
git push --set-upstream origin ${{ github.ref }} | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |