Lava v4.0.0 🌋 #129
Workflow file for this run
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: 'Lava Helm Charts - Populate tags' | |
on: | |
release: | |
types: [published] | |
permissions: write-all | |
jobs: | |
update_tags: | |
name: 'Lava Helm Charts - Populate tags' | |
runs-on: ubuntu-latest | |
environment: default | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Confirm tag is in main branch | |
id: tag_main | |
run: | | |
branches=$(git branch -r --contains tags/$GITHUB_REF_NAME) | |
for branch in $branches; do | |
if [[ $branch == "origin/main" ]]; then | |
echo "CHECK=true" >> $GITHUB_OUTPUT | |
fi | |
done | |
if [ "$onProtectedBranch" == false ]; then | |
echo "Tag not in main branch." | |
echo "CHECK=false" >> $GITHUB_OUTPUT | |
exit 1 | |
fi | |
- name: Get last 10 tags | |
id: tags_populate | |
run: | | |
new_tags=$(git tag --sort=-version:refname | head -n 10) | |
new_tags_array=$(echo "$new_tags" | tr '\n' ' ') | |
echo "$new_tags_array" | |
echo "new_tags_array=$new_tags_array" >> $GITHUB_OUTPUT | |
- name: Checkout lava helm charts repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GIT_TOKEN }} | |
repository: "lavanet/lava-helm-charts" | |
- name: Populate helm charts repository with new tags | |
run: | | |
new_tags_array=$(echo '${{ steps.tags_populate.outputs.new_tags_array }}' | tr '\n' ' ') | |
index=0 | |
for version in $new_tags_array; do | |
echo "$version" | |
index="$index" version="$version" yq -i '.tags[env(index)] = env(version)' .github/tags.yaml | |
index=$((index+1)) | |
done | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . | |
git commit -m "(Bot) Update list of tags for CI/CD" | |
git push |