chore(deps): update dependency mikefarah/yq to v4.42.1 #68
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: on-commit | |
on: | |
workflow_dispatch: | |
push: | |
branches-ignore: | |
- "v[0-9]*" # ignore build on tag branch | |
jobs: | |
build: | |
name: "Test dev and final release creation" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
id: checkout_repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
path: ./create-bosh-release-action | |
- name: Checkout repository test repo | |
id: checkout_test_repo | |
uses: actions/checkout@v4 | |
with: | |
repository: 'orange-cloudfoundry/create-bosh-release-action-test-boshrelease' | |
fetch-depth: 0 | |
# ref: v1.0 | |
token: ${{ secrets.CREATE_BOSH_RELEASE_ACTION_TEST_BOSHRELEASE_GIT_TOKEN }} | |
path: ./create-bosh-release-action-test-boshrelease | |
- name: Setup test | |
run: | | |
git clone create-bosh-release-action-test-boshrelease dev-release-creation-test | |
git clone create-bosh-release-action-test-boshrelease final-release-creation-test | |
- name: Test dev release creation | |
id: test_dev_release | |
uses: ./create-bosh-release-action/ # uses: ./.github/actions/my-private-repo/my-action #https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-an-action-inside-a-different-private-repository-than-the-workflow | |
with: | |
target_branch: main | |
dir: dev-release-creation-test | |
- name: Generated test dev files status | |
run: | | |
ls -lrt | |
cd dev-release-creation-test | |
echo "Display dev-release-creation-test(create-bosh-release-action-test-boshrelease) git repo status:" | |
git status | |
echo "List existing tags:" | |
git tag --list | |
cd .. | |
- name: Test final release creation existing tag | |
id: test_final_release | |
uses: ./create-bosh-release-action/ # uses: ./.github/actions/my-private-repo/my-action #https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-an-action-inside-a-different-private-repository-than-the-workflow | |
with: | |
repository: orange-cloudfoundry/create-bosh-release-action-test-boshrelease | |
token: ${{ secrets.CREATE_BOSH_RELEASE_ACTION_TEST_BOSHRELEASE_GIT_TOKEN }} | |
target_branch: main | |
dir: final-release-creation-test | |
tag_name: "v0.3.0" | |
override_existing: "true" | |
debug: 1 | |
- name: Assert final files status - override | |
env: | |
OUTPUT_VERSION: "${{ steps.test_final_release.outputs.version }}" | |
OUTPUT_TAGGED_VERSION: "${{ steps.test_final_release.outputs.tagged_version }}" | |
OUTPUT_NEED_GH_RELEASE: "${{ steps.test_final_release.outputs.need_gh_release }}" | |
EXPECTED_OUTPUT_VERSION: "0.3.0" | |
EXPECTED_OUTPUT_TAGGED_VERSION: "v0.3.0" | |
EXPECTED_OUTPUT_NEED_GH_RELEASE: "false" | |
run: | | |
ls -lrt | |
cd final-release-creation-test | |
echo "Display final-release-creation-test(create-bosh-release-action-test-boshrelease) git repo status:" | |
git status | |
echo "Checking tgz" | |
ls -l create-bosh-release-action-test-boshrelease-0.3.0.tgz | |
echo "List existing tags:" | |
git tag --list | |
echo "Ensure tag exist v0.3.0" | |
git tag --list|grep -E "^v0.3.0$" | |
cd .. | |
for o in OUTPUT_VERSION OUTPUT_TAGGED_VERSION OUTPUT_NEED_GH_RELEASE;do | |
output=$(echo "echo \$$o") | |
output_value=$(eval $output) | |
expected=$(echo "echo \$EXPECTED_$o") | |
expected_value=$(eval $expected) | |
if [[ "$expected_value" != "$output_value" ]];then | |
failure="true" | |
echo "ERROR: $o - expected_value ($expected_value) != output_value ($output_value)" | |
else | |
echo "$o is fine ($expected_value)" | |
fi | |
done | |
if [ "$failure" = "true" ]; then | |
echo "Test failure detected" | |
exit 1 | |
fi | |
- name: Get Next Version | |
id: semver-final-release | |
run: | | |
cd create-bosh-release-action-test-boshrelease | |
latest_tag=$(git describe --tags --abbrev=0) | |
echo "latest tag found: $latest_tag" | |
major_minor=$(echo $latest_tag|cut -d'.' -f1-2) | |
patch=$(echo $latest_tag|cut -d'.' -f3) | |
next_patch=$((patch + 1)) | |
nextVersion=${major_minor}.$next_patch | |
nextStrictVersion=${major_minor#v}.$next_patch | |
echo "nextVersion: $nextVersion" | |
echo "nextVersion=$nextVersion" >> "$GITHUB_OUTPUT" | |
echo "nextStrictVersion=$nextStrictVersion" >> "$GITHUB_OUTPUT" | |
cd .. | |
- name: Test final release creation new tag | |
id: test_final_new_release | |
uses: ./create-bosh-release-action/ # uses: ./.github/actions/my-private-repo/my-action #https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-an-action-inside-a-different-private-repository-than-the-workflow | |
with: | |
repository: orange-cloudfoundry/create-bosh-release-action-test-boshrelease | |
token: ${{ secrets.CREATE_BOSH_RELEASE_ACTION_TEST_BOSHRELEASE_GIT_TOKEN }} | |
target_branch: main | |
dir: final-release-creation-test | |
tag_name: "${{ steps.semver-final-release.outputs.nextVersion }}" | |
override_existing: "false" | |
debug: 1 | |
- name: Assert final files status - new | |
env: | |
NEXT_VERSION: "${{ steps.semver-final-release.outputs.nextVersion }}" | |
OUTPUT_VERSION: "${{ steps.test_final_new_release.outputs.version }}" | |
OUTPUT_TAGGED_VERSION: "${{ steps.test_final_new_release.outputs.tagged_version }}" | |
OUTPUT_NEED_GH_RELEASE: "${{ steps.test_final_new_release.outputs.need_gh_release }}" | |
EXPECTED_OUTPUT_VERSION: "${{ steps.semver-final-release.outputs.nextStrictVersion }}" | |
EXPECTED_OUTPUT_TAGGED_VERSION: "${{ steps.semver-final-release.outputs.nextVersion }}" | |
EXPECTED_OUTPUT_NEED_GH_RELEASE: "true" | |
run: | | |
ls -lrt | |
cd final-release-creation-test | |
echo "Display final-release-creation-test(create-bosh-release-action-test-boshrelease) git repo status:" | |
git status | |
echo "Checking tgz" | |
expected_version=${NEXT_VERSION#v} | |
ls -l create-bosh-release-action-test-boshrelease-$expected_version.tgz | |
echo "List existing tags:" | |
git tag --list | |
echo "Ensure tag exist" | |
git tag --list|grep -E "^$NEXT_VERSION$" | |
cd .. | |
for o in OUTPUT_VERSION OUTPUT_TAGGED_VERSION OUTPUT_NEED_GH_RELEASE;do | |
output=$(echo "echo \$$o") | |
output_value=$(eval $output) | |
expected=$(echo "echo \$EXPECTED_$o") | |
expected_value=$(eval $expected) | |
if [[ "$expected_value" != "$output_value" ]];then | |
failure="true" | |
echo "ERROR: $o - expected_value ($expected_value) != output_value ($output_value)" | |
else | |
echo "$o is fine ($expected_value)" | |
fi | |
done | |
if [ "$failure" = "true" ]; then | |
echo "Test failure detected" | |
exit 1 | |
fi |