Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
haouarihk authored Oct 31, 2023
1 parent dbefcd7 commit b6ee74d
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Extract version from commit message
id: ver
run: |
Expand All @@ -24,6 +24,29 @@ jobs:
echo "exit no version x.x.x in the commit message"
exit 1
fi
# Remove existing data.json file
- name: Remove data.json
run: rm -f data.json

# Get a list of all the files in the prompts folder
- name: Get list of prompts
run: ls prompts > prompts.txt

# Remove the file extension from each file name
- name: Remove file extensions
run: sed -i 's/\..*$//' prompts.txt

# Create data.json with the list of prompts
- name: Create data.json
run: |
sed -i 's/^/ "/' prompts.txt
sed -i 's/$/",/' prompts.txt
echo "{
\"prompts\": [
$(cat prompts.txt)
]
}" > data.json
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down Expand Up @@ -52,3 +75,9 @@ jobs:
asset_path: manifest.json
asset_name: manifest.json
asset_content_type: application/json

- name: push data.json
run: |
git config user.name ${{ github.actor }}
git config user.email ${{ github.actor }}
git diff --exit-code || git commit -am "Updated data.json" && git push

0 comments on commit b6ee74d

Please sign in to comment.