Publish #21
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version tag to publish (e.g. v1.2.3)" | |
required: true | |
type: string | |
jobs: | |
publish: | |
name: Publish Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Update version in mix.exs | |
env: | |
RELEASE_VERSION: ${{ inputs.version }} | |
run: | | |
# Configure Git user | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
# Update version in mix.exs | |
sed -i 's/version: ".*"/version: "'${RELEASE_VERSION#v}'"/g' mix.exs | |
git add mix.exs | |
git commit -m "chore: Bump version to ${RELEASE_VERSION}" | |
git push origin HEAD | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create ${{ inputs.version }} \ | |
--title "Release ${{ inputs.version }}" \ | |
--generate-notes | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: "1.16.2" | |
otp-version: "26.2.5" | |
- name: Install dependencies | |
run: mix deps.get | |
- name: Generate docs | |
run: mix docs | |
- name: Publish to Hex.pm | |
env: | |
HEX_API_KEY: ${{ secrets.HEX_API_KEY }} | |
run: mix hex.publish --yes |