Merge pull request #7 from http4k/update-dependencies #22
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: Build in CI | |
| 'on': | |
| workflow_dispatch: { | |
| } | |
| push: | |
| paths-ignore: | |
| - '**/.md' | |
| pull_request: | |
| paths-ignore: | |
| - '**/.md' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| name: Build and Test | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5.0.0 | |
| - name: Setup Java | |
| uses: actions/setup-java@v5.0.0 | |
| with: | |
| java-version: '21' | |
| distribution: adopt | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4.4.2 | |
| - name: Build | |
| run: ./gradlew check --info | |
| shell: bash | |
| - name: Release (if required) | |
| id: get-version | |
| if: github.ref == 'refs/heads/main' | |
| run: |- | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| git remote set-url origin https://x-access-token:$GH_TOKEN@github.com/http4k/standards.git | |
| LOCAL_VERSION=$(jq -r .http4k.version version.json) | |
| git fetch --deepen=1 || true | |
| if git rev-parse HEAD~1 >/dev/null 2>&1; then | |
| CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD) | |
| else | |
| CHANGED_FILES=$(git show --name-only --pretty=format: HEAD) | |
| fi | |
| if [[ "$CHANGED_FILES" != *version.json* ]]; then | |
| echo "Version did not change on this commit. Ignoring" | |
| echo "tag-created=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| git tag -a "$LOCAL_VERSION" -m "Typeflows JVM version $LOCAL_VERSION" | |
| git push origin "$LOCAL_VERSION" | |
| # Output tag for repository dispatch | |
| echo "tag=$LOCAL_VERSION" >> $GITHUB_OUTPUT | |
| echo "tag-created=true" >> $GITHUB_OUTPUT | |
| env: | |
| GH_TOKEN: ${{ secrets.TOOLBOX_REPO_TOKEN }} | |
| shell: bash | |
| - name: Repository Dispatch | |
| if: (github.ref == 'refs/heads/main' && steps.get-version.outputs.tag-created | |
| == 'true') | |
| run: |- | |
| curl -L \ | |
| -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer $GH_TOKEN" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| https://api.github.com/repos/${{ github.repository }}/dispatches \ | |
| -d '{"event_type":"release","client_payload":{"tag":"${{ steps.get-version.outputs.tag }}"}}' | |
| env: | |
| GH_TOKEN: ${{ secrets.TOOLBOX_REPO_TOKEN }} | |
| shell: bash |