Merge pull request #1877 from gooddata/INFRA-3527 #1
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: post | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
- release | |
- hotfix/[0-9]+.[0-9]+ | |
- hotfix/[0-9]+.[0-9]+.[0-9]+ | |
- gd-patches | |
- next-[0-9]+.[0-9]+.[0-9]+ | |
jobs: | |
prepare-env: | |
runs-on: | |
group: infra1-runners-arc | |
labels: runners-small | |
outputs: | |
branch: ${{ steps.branch.outputs.branch }} | |
ref: ${{ github.ref }} | |
commit: ${{ github.event.after }} | |
project: ${{ github.repository }} | |
changed_files: ${{ steps.changed-files.outputs.all_changed_files }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v40 | |
- name: Extract branch name | |
id: branch | |
run: |- | |
branch=$(echo "${{ github.ref }}" | sed 's/^refs\/heads\///') | |
echo "branch=$branch" >> "$GITHUB_OUTPUT" | |
gooddata-react-components-gate-prerelease: | |
runs-on: | |
group: infra1-runners-arc | |
labels: runners-small | |
needs: | |
- prepare-env | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Check if all changed files match patterns | |
id: all-match | |
run: |- | |
any_didnt_match=false | |
patterns=('^package\.json$') | |
for file in ${{ needs.prepare-env.outputs.changed_files }}; do | |
matched=false | |
for pattern in "${patterns[@]}"; do | |
if [[ $file =~ $pattern ]]; then | |
matched=true | |
fi | |
done | |
if [[ $matched == false ]]; then | |
any_didnt_match=true | |
fi | |
done | |
echo "any_didnt_match=$any_didnt_match" >> "$GITHUB_OUTPUT" | |
- name: Check if branch matches | |
id: branch-matches | |
run: |- | |
branch=${{ needs.prepare-env.outputs.branch }} | |
branch_matches=$([[ $branch =~ ^develop$ ]] && echo true || echo false) | |
echo "branch_matches=$branch_matches" >> "$GITHUB_OUTPUT" | |
- name: Call Jenkins trigger | |
id: call-jenkins | |
uses: gooddata/github-actions-public/jenkins/trigger@master | |
with: | |
server: ${{ secrets.JENKINS_ADDRESS }} | |
folder: client-libs | |
job-name: gooddata-react-components-gate-prerelease | |
vault-url: ${{ secrets.VAULT_ADDRESS }} | |
params: |- | |
{ | |
"GH_BRANCH": "${{ needs.prepare-env.outputs.branch }}", | |
"GH_REF": "${{ needs.prepare-env.outputs.ref }}", | |
"GH_COMMIT": "${{ needs.prepare-env.outputs.commit }}", | |
"GH_URL": "[email protected]:", | |
"GH_PROJECT": "${{ needs.prepare-env.outputs.project }}", | |
"BUILD_BY_GITHUB": "true", | |
"GH_PIPELINE": "post" | |
} | |
if: steps.all-match.outputs.any_didnt_match == 'true' && steps.branch-matches.outputs.branch_matches == 'true' | |
merge-success: | |
runs-on: | |
group: infra1-runners-arc | |
labels: runners-small | |
if: always() | |
needs: | |
- prepare-env | |
- gooddata-react-components-gate-prerelease | |
steps: | |
- name: Check if needed jobs succeeded | |
uses: re-actors/alls-green@release/v1 | |
with: | |
allowed-skips: ${{ toJSON(needs) }} | |
jobs: ${{ toJSON(needs) }} |