Publish New Release #7
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: Publish New Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: choice | |
description: What version to publish? | |
options: | |
- patch | |
- minor | |
- major | |
changes: | |
description: Specify an entry for the changelog | |
required: true | |
jobs: | |
ci: | |
uses: ./.github/workflows/elixir.yml | |
secrets: inherit | |
publish: | |
needs: [ci] | |
name: Build and publish to hex.pm | |
runs-on: ubuntu-20.04 | |
env: | |
HEX_API_KEY: ${{ secrets.HEX_API_KEY }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GH_PUBLISH_PAT }} | |
fetch-depth: 0 | |
ref: master | |
- name: Git Config | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
- name: Setup Elixir | |
uses: erlef/setup-elixir@v1 | |
with: | |
otp-version: '24.0' | |
elixir-version: '1.12' | |
- name: Restore dependencies cache | |
uses: actions/cache@v2 | |
with: | |
path: deps | |
key: ${{ runner.os }}-publish-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-publish-mix- | |
- name: Install deps | |
run: mix deps.get | |
- name: Add changelog entry | |
run: echo "${{ inputs.changes }}" > RELEASE.md | |
- name: Bump version, generate changelog, push to git, publish on hex.pm | |
run: mix expublish.${{ inputs.version }} --disable-test | |