Release Commit #37
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 Commit | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version_name: | ||
description: "Number of the version of the RDM to release" | ||
required: true | ||
type: string | ||
jobs: | ||
release_commit: | ||
runs-on: ubuntu-latest | ||
env: | ||
GH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
CI_COMMIT_MESSAGE: "New RDM release: ${{inputs.version_name}}" | ||
steps: | ||
- name: checkhout | ||
uses: actions/checkout@v3 | ||
- name: Commit changes | ||
working-directory: ${{github.workspace}} | ||
shell: bash | ||
run: | | ||
Check failure on line 24 in .github/workflows/create_release_commit.yml GitHub Actions / Release CommitInvalid workflow file
|
||
TODAY=$( date -u '+%Y-%m-%d' ) | ||
echo "${{inputs.version_name}} : $TODAY" >> RDM_version_history.txt | ||
FILE_TO_COMMIT=RDM_version_history.txt | ||
MESSAGE="$CI_COMMIT_MESSAGE" | ||
SHA=$( git rev-parse master:$FILE_TO_COMMIT ) | ||
CONTENT=$( base64 -i $FILE_TO_COMMIT ) | ||
echo "Push commit" | ||
gh api --method PUT /repos/:owner/:repo/contents/$FILE_TO_COMMIT \ | ||
--field message="${MESSAGE}" \ | ||
--field content="${CONTENT}" \ | ||
--field encoding="base64" \ | ||
--field branch="master" \ | ||
--field sha="${SHA}" \ | ||
--silent | ||
echo "Try request with sha: $SHA" | ||
echo '{"tag":"${{inputs.version_name}","message":"${CI_COMMIT_MESSAGE}","object":"${SHA}","type":"commit"}'>data.json | ||
cat data.json | ||
RESP=$(curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{secrets.GITHUB_TOKEN}} " \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/3LawsRobotics/3laws/git/tags \ | ||
-d @data.json\ | ||
--fail) | ||
echo "response $RESP" | ||
TAG_SHA=$(echo $RESP | jq -r '.sha') | ||
echo "Try request with tag_sha: $TAG_SHA" | ||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{secrets.GITHUB_TOKEN}} " \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/3LawsRobotics/3laws/git/refs \ | ||
-d '{"ref":"refs/tags/${TAG}","sha":"${TAG_SHA}"}' \ | ||
--fail |