Skip to content

0.0.4

0.0.4 #4

Workflow file for this run

name: Release
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract version from commit message
id: ver
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
echo "Commit message: $COMMIT_MESSAGE"
if [[ $COMMIT_MESSAGE =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "version=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT
else
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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.ver.outputs.version }}
release_name: ${{ steps.ver.outputs.version }}
draft: false
prerelease: false
- name: Attach data.json
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: data.json
asset_name: data.json
asset_content_type: application/json
- name: Attach manifest.json
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
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