feat: build release on tag push #3
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: Tests | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| tags: | |
| - '*' | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag for release (e.g. v1.0.0)' | |
| required: true | |
| type: string | |
| jobs: | |
| test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Erlang | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: "26" | |
| rebar3-version: "3" | |
| - name: Start Dependencies | |
| run: make up | |
| - name: Run Tests | |
| run: make ct | |
| - name: Cleanup | |
| if: always() | |
| run: make down | |
| release: | |
| needs: test | |
| if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }} | |
| - name: Setup Erlang | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: "26" | |
| rebar3-version: "3" | |
| - name: Build Release | |
| run: make rel | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }} | |
| files: _build/default/emqx_plugrel/emqx_offline_message_plugin-*.tar.gz | |
| generate_release_notes: true |