This repository has been archived by the owner on Nov 21, 2023. It is now read-only.
update_service #83
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: "update_service" | |
on: | |
workflow_dispatch: | |
inputs: | |
name: | |
description: 'Name of the service' | |
required: true | |
version: | |
description: 'Version of the service' | |
required: true | |
url: | |
description: 'Url of the service package' | |
required: true | |
sha256: | |
description: 'SHA256 hash of the service package' | |
required: true | |
jobs: | |
update: | |
name: "Update service" | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }} | |
- name: Download jq | |
run: | | |
curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 -o /usr/local/bin/jq | |
chmod +x /usr/local/bin/jq | |
- name: Update ${{ github.event.inputs.name }} services.json to ${{ github.event.inputs.version }} | |
run: | | |
# check the service already exists | |
jq -e 'has("${{ github.event.inputs.name }}")' fluence/services.json | |
# update service's record | |
UPDATED=$(jq '."${{ github.event.inputs.name }}" = { | |
"version": "${{ github.event.inputs.version }}", | |
"url": "${{ github.event.inputs.url }}", | |
"sha256": "${{ github.event.inputs.sha256 }}" | |
}' fluence/services.json) | |
# write updated content to disk | |
echo "$UPDATED" > fluence/services.json | |
- name: Commit updated fluence.json | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: 'fix(deps): Update ${{ github.event.inputs.name }} to ${{ github.event.inputs.version }}' | |
commit_user_name: fluencebot | |
commit_user_email: devops@fluence.one | |
commit_author: fluencebot <devops@fluence.one> |