trigger-release #99
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: Release Workflow | |
on: | |
repository_dispatch: | |
types: [trigger-release] | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Git | |
run: | | |
git config user.name "nanuijaz" | |
git config user.email "[email protected]" | |
- name: Get latest release version | |
id: get-latest-release | |
run: | | |
latestTag=$(curl -s "https://api.github.com/repos/IntersectMBO/cardano-db-sync/releases/latest" | jq -r '.tag_name') | |
echo "${latestTag}" | |
if [ -n "$latestTag" ]; then | |
echo "RELEASE_TAG=${latestTag}" >> $GITHUB_ENV | |
else | |
echo "Failed to retrieve the latest release tag. API response: $response" | |
fi | |
- name: Create release in forked repository | |
run: | | |
if [ -n "${RELEASE_TAG}" ]; then | |
git tag -a "${RELEASE_TAG}" -m "Release notes for ${RELEASE_TAG}" | |
git push origin "${RELEASE_TAG}" | |
curl -X POST \ | |
-H "Authorization: Bearer ${{ secrets.WORKFLOW_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
"https://api.github.com/repos/Emurgo/cardano-db-sync/releases" \ | |
-d '{"tag_name": "'"${RELEASE_TAG}"'", "name": "'"${RELEASE_TAG}"'", "body": "Release notes for '"${RELEASE_TAG}"'"}' | |
else | |
echo "No release tag available. Skipping release creation." | |
fi | |
- name: Display latest release version | |
run: | | |
echo "Latest Release: $RELEASE_TAG" |