Merge pull request #8 from ipdata/claude/fix-issue-3Hl6Y #12
Workflow file for this run
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: Publish to Hex.pm | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| otp: ['25', '26', '27'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: ${{ matrix.otp }} | |
| rebar3-version: '3.24' | |
| - name: Restore dependencies cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: _build | |
| key: ${{ runner.os }}-otp-${{ matrix.otp }}-build-${{ hashFiles('rebar.config') }} | |
| restore-keys: ${{ runner.os }}-otp-${{ matrix.otp }}-build- | |
| - name: Compile | |
| run: rebar3 compile | |
| - name: Run tests | |
| run: rebar3 ct | |
| - name: Run dialyzer | |
| run: rebar3 dialyzer | |
| - name: Run xref | |
| run: rebar3 xref | |
| publish: | |
| name: Publish to Hex.pm | |
| needs: test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: '27' | |
| rebar3-version: '3.24' | |
| - name: Restore dependencies cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: _build | |
| key: ${{ runner.os }}-otp-27-build-${{ hashFiles('rebar.config') }} | |
| restore-keys: ${{ runner.os }}-otp-27-build- | |
| - name: Check HEX_API_KEY | |
| run: | | |
| if [ -z "$HEX_API_KEY" ]; then | |
| echo "::error::HEX_API_KEY secret is not set. Go to repo Settings > Secrets and variables > Actions and add a HEX_API_KEY secret with a valid hex.pm write key." | |
| exit 1 | |
| fi | |
| env: | |
| HEX_API_KEY: ${{ secrets.HEX_API_KEY }} | |
| - name: Publish to Hex.pm | |
| run: rebar3 hex publish --yes | |
| env: | |
| HEX_API_KEY: ${{ secrets.HEX_API_KEY }} | |
| - name: Generate and publish docs | |
| run: | | |
| rebar3 ex_doc | |
| rebar3 hex docs publish --yes | |
| env: | |
| HEX_API_KEY: ${{ secrets.HEX_API_KEY }} |