Test JQ version #96
This file contains hidden or 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: Test JQ version | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| ref: | |
| description: "The fully-formed ref of the branch or tag that triggered the workflow run" | |
| required: false | |
| type: "string" | |
| sha: | |
| description: "The sha of the commit that triggered the workflow run" | |
| required: false | |
| type: "string" ## Added pull_request to register workflow from the PR. | |
| ## Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo | |
| # pull_request: {} | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup | |
| run: echo "Do setup" | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: [setup] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: 'Setup jq' | |
| uses: dcarbone/[email protected] | |
| with: | |
| version: 1.5 | |
| force: 'true' | |
| - name: Downgrade version | |
| id: base | |
| run: | | |
| chmod +x /opt/hostedtoolcache/jq/jq | |
| echo "version=$(jq --version)" >> $GITHUB_OUTPUT | |
| - uses: nick-fields/assert-action@v2 | |
| with: | |
| expected: 'jq-1.5' | |
| actual: ${{ steps.base.outputs.version }} | |
| - uses: ./ | |
| id: current | |
| with: | |
| env-label: | | |
| preview: deploy | |
| qa1: deploy/qa1 | |
| qa2: deploy/qa2 | |
| qa3: deploy/qa3 | |
| qa4: deploy/qa4 | |
| labels: '["deploy","deploy/qa2"]' | |
| open: 'true' | |
| - name: Current version | |
| id: new | |
| run: | | |
| jq --version | |
| echo "version=$(jq --version)" >> $GITHUB_OUTPUT | |
| - uses: nick-fields/assert-action@v2 | |
| with: | |
| expected: 'jq-1.6' | |
| actual: ${{ steps.new.outputs.version }} | |
| - uses: nick-fields/assert-action@v2 | |
| with: | |
| expected: '["preview","qa2"]' | |
| actual: ${{ steps.current.outputs.deploy_envs }} | |
| - uses: nick-fields/assert-action@v2 | |
| with: | |
| expected: '["qa1","qa3","qa4"]' | |
| actual: ${{ steps.current.outputs.destroy_envs }} | |
| teardown: | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| if: ${{ always() }} | |
| steps: | |
| - name: Tear down | |
| run: echo "Do Tear down" |