diff --git a/.github/actions/update-version/action.yaml b/.github/actions/verify-version/action.yaml similarity index 57% rename from .github/actions/update-version/action.yaml rename to .github/actions/verify-version/action.yaml index 6de9a61..a81b740 100644 --- a/.github/actions/update-version/action.yaml +++ b/.github/actions/verify-version/action.yaml @@ -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 /vars/main against tag" runs: using: composite @@ -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}" ] diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index a0cce95..3b32a1e 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -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 diff --git a/.github/workflows/build-test-and-publish.yaml b/.github/workflows/build-test-and-publish.yaml index 4fcefd0..4b0d8fd 100644 --- a/.github/workflows/build-test-and-publish.yaml +++ b/.github/workflows/build-test-and-publish.yaml @@ -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