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
  • Loading branch information
WStechura committed Nov 29, 2024
1 parent d0adaac commit 236d2c3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 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 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 matches tag"
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 matches tag"
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}" ]
4 changes: 4 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
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
5 changes: 3 additions & 2 deletions .github/workflows/build-test-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name:
- name: Set environment variables
uses: ./.github/actions/set-environment-variables
- name: Update version
uses: ./.github/actions/update-version
- name: Verify version
uses: ./.github/actions/verify-version
- name: Set up environment
uses: ./.github/actions/setup-build-environment
- name: Build the collection
Expand Down

0 comments on commit 236d2c3

Please sign in to comment.