Skip to content

Commit

Permalink
Add check for verifying versions in galaxy.yml and vars/main.yml agai…
Browse files Browse the repository at this point in the history
…nst latest tag (#53)

* Add check for verifying versions in galaxy.yml and vars/main.yml against latest tag
  • Loading branch information
WStechura authored Dec 2, 2024
1 parent 7f3bc5f commit a412454
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: "Update version"
description: "Updates version"
name: "Verify version"
description: "Verifies version in galaxy.yml and <role_dir>/vars/main against latest tag"

runs:
using: composite
Expand All @@ -22,28 +22,24 @@ runs:
shell: bash
run: printf "LATEST_TAG=%s\n" "$(git describe --tags --abbrev=0 --always)" >> $GITHUB_ENV

- name: "Extract version"
- name: "Extract version from tag"
shell: bash
run: |
latestTag="${{ env.LATEST_TAG }}"
printf "LATEST_VERSION=%s\n" "${latestTag#v}" >> $GITHUB_ENV
- name: "Update galaxy.yml version"
- name: "Verify galaxy.yml version"
shell: bash
run: |
latestVersion="${{ env.LATEST_VERSION }}"
sed -i "s/version: .*/version: ${latestVersion}/" galaxy.yml
- name: "Configure git"
shell: bash
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: "Commit and push changes"
galaxyVersion="$(sed -n "s/version: \(.*\)/\1/p" galaxy.yml)"
printf "Latest version: %s, galaxy version: %s" "${latestVersion}" "${galaxyVersion}"
[ "${latestVersion}" = "${galaxyVersion}" ]
- name: "Verify vars/main.yml version"
shell: bash
run: |
git checkout master
git add galaxy.yml
git commit -m "Update galaxy.yaml version to ${{ env.LATEST_VERSION }}"
git push origin master
latestVersion="${{ env.LATEST_VERSION }}"
roleVersion="$(sed -n "s/oneagent_script_version: \(.*\)/\1/p" roles/oneagent/vars/main.yml)"
printf "Latest version: %s, role version: %s" "${latestVersion}" "${roleVersion}"
[ "${latestVersion}" = "${roleVersion}" ]
2 changes: 2 additions & 0 deletions .github/workflows/build-test-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
fetch-depth: 0
- name: Set environment variables
uses: ./.github/actions/set-environment-variables
- name: Verify version
uses: ./.github/actions/verify-version
- name: Set up environment
uses: ./.github/actions/setup-build-environment
- name: Build the collection
Expand Down
1 change: 0 additions & 1 deletion roles/oneagent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ uses provided installation parameters and runs `oneagentctl` with them, skipping
- In case no `environment_url`, `paas_token` and `local_installer` parameters are provided,
the script runs `oneagentctl` with provided parameters directly.

Script does not supply `--restart-service` option to `oneagentctl` by itself.
For full list of suitable parameters, see [OneAgent configuration via command-line interface].

## Variables
Expand Down

0 comments on commit a412454

Please sign in to comment.