Skip to content

Release Commit

Release Commit #12

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
steps:
- name: checkhout
uses: actions/checkout@v3
- name: Commit changes
working-directory: ${{github.workspace}}
env:
CI_COMMIT_MESSAGE: "New RDM release: ${{inputs.version_name}}"
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
TODAY=$( date -u '+%Y-%m-%d' )
echo "${{inputs.version_name}} : $TODAY" >> RDM_version_history.txt
FILE_TO_COMMIT=RDM_version_history.txt
export MESSAGE="CI_COMMIT_MESSAGE"
export SHA=$( git rev-parse master:$FILE_TO_COMMIT )
export CONTENT=$( base64 -i $FILE_TO_COMMIT )
gh api --method PUT /repos/:owner/:repo/contents/$FILE_TO_COMMIT \
--field message="$MESSAGE" \
--field content="$CONTENT" \
--field encoding="base64" \
--field branch="$DESTINATION_BRANCH" \
--field sha="$SHA"
gh api --method POST /repos/:owner/:repo/git/tags \
--field tag="${{inputs.version_name}}" \
--field message="$CONTENT" \
--field encoding="base64" \
--field type="commit" \
--field object="$SHA"