diff --git a/.github/workflows/code-health-foas-lib.yml b/.github/workflows/code-health-foas-lib.yml index 59dbeb6caf..e97d49ebdf 100644 --- a/.github/workflows/code-health-foas-lib.yml +++ b/.github/workflows/code-health-foas-lib.yml @@ -1,4 +1,4 @@ -name: 'Code Health Foas Library' +name: 'Code Health FOAS Library' on: push: branches: diff --git a/.github/workflows/code-health-foascli.yml b/.github/workflows/code-health-foascli.yml index 72d128e245..6371bf95ef 100644 --- a/.github/workflows/code-health-foascli.yml +++ b/.github/workflows/code-health-foascli.yml @@ -3,14 +3,16 @@ on: push: branches: - main - paths: + paths: - 'tools/cli/**' + - 'tools/foas/**' - '.github/workflows/code-health-foascli.yml' pull_request: branches: - main paths: - 'tools/cli/**' + - 'tools/foas/**' - '.github/workflows/code-health-foascli.yml' workflow_dispatch: {} workflow_call: {} diff --git a/.github/workflows/release-foas-lib.yml b/.github/workflows/release-foas-lib.yml new file mode 100644 index 0000000000..135973d873 --- /dev/null +++ b/.github/workflows/release-foas-lib.yml @@ -0,0 +1,61 @@ +name: 'FOAS Library New Release' +run-name: 'Release foas ${{ inputs.version_number }} (skip tests: ${{ inputs.skip_tests }})' + +# Used for releasing the tools/foas Go library module. +on: + workflow_dispatch: + inputs: + version_number: + description: 'Version number (e.g., v1.0.0, v1.0.0-pre, v1.0.0-pre1)' + required: true + skip_tests: + description: 'Set value to `true` to skip tests, default is `false`' + default: 'false' + +permissions: + contents: read + +jobs: + run-tests: + if: >- + !cancelled() + && inputs.skip_tests == 'false' + uses: ./.github/workflows/code-health-foas-lib.yml + + create-tag: + runs-on: ubuntu-latest + needs: [ run-tests ] + permissions: + contents: write # required to push the release tag + # Tag is created only when tests pass (or are explicitly skipped). + if: >- + !cancelled() + && !contains(needs.*.result, 'failure') + steps: + - name: Validation of version format + run: | + echo "${{ inputs.version_number }}" | grep -P '^v\d+\.\d+\.\d+(-pre[A-Za-z0-9-]*)?$' + - name: Checkout + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 + - name: Get the latest commit SHA + id: get-sha + run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + - name: Create Go submodule tag for tools/foas + uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 + with: + tag: tools/foas/${{ inputs.version_number }} + commit_sha: ${{ steps.get-sha.outputs.sha }} + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg_passphrase: ${{ secrets.PASSPHRASE }} + + failure-handler: + name: Failure Handler + needs: [ run-tests, create-tag ] + if: ${{ always() && contains(needs.*.result, 'failure') }} + uses: ./.github/workflows/failure-handler.yml + with: + env: "prod" + release_name: "FOAS Library" + team_id: ${{ vars.JIRA_TEAM_ID_APIX_PLATFORM }} + secrets: + jira_api_token: ${{ secrets.JIRA_API_TOKEN }}