Dependency Dashboard #201
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: build-deploy-metabase-on-issue | |
on: | |
issues: | |
types: [opened, edited] | |
jobs: | |
build-metabase-image: | |
name: Build Metabase Image. | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Issue Forms Body Parser | |
id: parse | |
uses: zentered/issue-forms-body-parser@v2.2.0 | |
- name: Stringify Result | |
if: ${{ steps.parse.outputs.data }} | |
uses: actions/github-script@v7 | |
id: set-result | |
with: | |
script: | | |
const data = ${{ steps.parse.outputs.data }}; | |
const version = data["metabase-version"].text; | |
return version; | |
result-encoding: string | |
- name: check if build is required. | |
id: check | |
run: | | |
# Check if version paramter is given. | |
METABASE_VERSION=${{ steps.set-result.outputs.result }} | |
URL="https://downloads.metabase.com/$METABASE_VERSION/metabase.jar" | |
if [ -z $METABASE_VERSION ] || [ $(curl -ILso /dev/null -w "%{http_code}" "${URL}") -ne 200 ] | |
then | |
echo "build=false" >> $GITHUB_OUTPUT; | |
exit 0 | |
fi | |
echo "build=true" >> $GITHUB_OUTPUT; | |
# | |
- name: Modify Files | |
if: steps.check.outputs.build == 'true' | |
id: modify_files | |
shell: bash | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
appVersion=${{ steps.set-result.outputs.result }} | |
version=${appVersion//v/} | |
git config --local user.name ${{ github.actor }} | |
git checkout -b deps/metabase-version-update-$appVersion | |
yq eval '.appVersion = $appVersion' -i charts/nr-metabase/Chart.yaml | |
yq eval '.version = $version' -i charts/nr-metabase/Chart.yaml | |
yq eval '.metabase.image.tag = $appVersion' -i charts/nr-metabase/values.yaml | |
yq eval '.global.appVersion = $appVersion' -i charts/nr-metabase/values.yaml | |
git add charts/nr-metabase/values.yaml charts/nr-metabase/Chart.yaml | |
git commit -m "Updating the version of the metabase image to $appVersion" | |
git push origin deps/metabase-version-update-$appVersion | |
# Create a Pull Request | |
gh pr create --assignee "mishraomp" --base main --label "dependencies" --title "Updating the version of the metabase image to $appVersion" --body "Updating the version of the metabase image to $appVersion." | |