-
Notifications
You must be signed in to change notification settings - Fork 0
Add release workflow and update README badges #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: ['v*'] | ||
| pull_request: | ||
| types: [closed] | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: write | ||
| packages: write | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release to Hex | ||
| runs-on: ubuntu-latest | ||
| if: >- | ||
| contains(github.ref, 'refs/tags/') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Start ClickHouse (for integration tests) | ||
| run: | | ||
| # If you keep the repository's docker-compose.yml with a service named `clickhouse` this will start it. | ||
| docker compose up -d clickhouse || true | ||
| echo "Waiting for ClickHouse to be ready..." | ||
| for i in $(seq 1 60); do | ||
| if curl -sSf http://localhost:8123/ >/dev/null 2>&1; then | ||
| echo "ClickHouse is ready" | ||
| break | ||
| fi | ||
| sleep 2 | ||
| done | ||
|
|
||
| - name: Setup Erlang/OTP and Gleam | ||
| uses: erlef/setup-beam@v1 | ||
| with: | ||
| otp-version: "27.0" | ||
| gleam-version: "1.13.0" | ||
|
|
||
| - name: Show versions | ||
| run: | | ||
| erl -version || true | ||
| gleam --version | ||
|
|
||
| - name: Cache Gleam deps and build | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cache/gleam | ||
| ~/.gleam | ||
| ./_gleam_deps | ||
| ./build | ||
| key: ${{ runner.os }}-gleam-1.13.0-otp27-release-${{ hashFiles('**/gleam.toml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gleam-1.13.0-otp27-release- | ||
|
|
||
| - name: Install dependencies | ||
| run: gleam deps download | ||
|
|
||
| - name: Check formatting | ||
| run: gleam format --check src test | ||
|
|
||
| - name: Build | ||
| run: gleam build | ||
|
|
||
| - name: Run tests | ||
| env: | ||
| CLICKHOUSE_USER: test_user | ||
| CLICKHOUSE_PASSWORD: test_password | ||
| CLICKHOUSE_DB: test_db | ||
| CLICKHOUSE_URL: http://localhost:8123 | ||
| run: gleam test | ||
|
|
||
| - name: Create tag from gleam.toml (on merged PR) | ||
| if: github.event_name == 'pull_request' && github.event.pull_request.merged == true | ||
| run: | | ||
| set -euo pipefail | ||
| VERSION=$(grep '^version' gleam.toml | sed -E 's/.*= *"([^"]+)".*/\1/') | ||
| TAG="v${VERSION}" | ||
| echo "Derived tag: ${TAG}" | ||
| # Ensure we have refs to push | ||
| git fetch origin --tags | ||
| if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then | ||
| echo "Tag ${TAG} already exists, skipping" | ||
| exit 0 | ||
| fi | ||
|
|
||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git tag -a "${TAG}" -m "Release ${TAG}" | ||
| # Push using the default authentication provided to the runner (GITHUB_TOKEN) | ||
| git push origin "${TAG}" | ||
| echo "Pushed tag ${TAG} to origin" | ||
|
|
||
| - name: Validate package (dry-run) | ||
| run: | | ||
| echo "Validating package before publishing..." | ||
| gleam publish --dry-run | ||
|
|
||
| - name: Publish to Hex | ||
| env: | ||
| HEXPM_API_KEY: ${{ secrets.HEX_API_KEY }} | ||
| run: | | ||
| echo "Publishing package to Hex..." | ||
| gleam publish --yes | ||
|
|
||
| - name: Create GitHub Release | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| body: | | ||
| Release ${{ github.ref_name }} | ||
|
|
||
| See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/CHANGELOG.md) for details. | ||
| draft: false | ||
| prerelease: false | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Cleanup ClickHouse | ||
| if: always() | ||
| run: docker compose down -v || true |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invalid character 'É' appears to be accidentally added. This line should likely be empty or removed.