Eco-GoInfra Module Bump #6
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: 'Eco-GoInfra Module Bump' | |
on: | |
workflow_dispatch: | |
env: | |
GIT_SSH_COMMAND: "ssh -i ~/.ssh/eco-gotests.id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" | |
jobs: | |
main: | |
name: Eco-goinfra module bump | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup agent and add repo ssh key | |
run: | | |
echo "${{ secrets.REPO_ACCESS_KEY }}" > ~/.ssh/eco-gotests.id_rsa | |
chmod 0600 ~/.ssh/eco-gotests.id_rsa | |
- name: Set up Go 1.22 | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22.6 | |
- name: Check for eco-goinfra module updates | |
id: new_mods | |
env: | |
ECO_GOTESTS_CLONE_URL: [email protected]:openshift-kni/eco-gotests.git | |
run: | | |
git remote set-url origin $ECO_GOTESTS_CLONE_URL | |
git pull origin | |
if [[ ! `git branch -a | grep eco-goinfra-dep-bump` ]]; then | |
git config user.name 'GitHub Actions' | |
git config user.email '[email protected]' | |
go get github.com/openshift-kni/eco-goinfra | |
go mod tidy | |
go mod vendor | |
fi | |
if [[ ! -z `git diff-index --name-only HEAD --` ]]; then | |
echo "changed=true" >> $GITHUB_OUTPUT | |
else | |
echo "changed=false" >> $GITHUB_OUTPUT | |
echo "Nothing to update" | |
fi | |
- name: Push changes to new branch | |
if: steps.new_mods.outputs.changed == 'true' | |
run: | | |
export MODULE=$(go list -m -f '{{.Version}}' github.com/openshift-kni/eco-goinfra) | |
git checkout -b eco-goinfra-dep-bump-$MODULE | |
git add go.mod go.sum vendor | |
git commit -m "deps: bumping eco-goinfra module to ${MODULE}" | |
git push origin eco-goinfra-dep-bump-$MODULE |