Skip to content

release

release #5

Workflow file for this run

name: release
on:
workflow_dispatch:
inputs:
release-version:
required: true
description: 'The version of the release'
default: '0.1.0'
git-ref:
required: true
description: 'The git revison of repo, branch, tag or commit'
default: 'main'
permissions:
contents: write
jobs:
release:
name: Publish release to hex.pm
runs-on: ubuntu-latest
env:
MIX_ENV: docs
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.git-ref }}
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: 27
elixir-version: 1.18
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install Deps
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
run: |
cd ${{ github.workspace }}/native/html_minifier_native
cargo build --release
cd ${{ github.workspace }}
mix deps.get
sed -i 's%@version "[0-9\.]\+"%@version "${{ github.event.inputs.release-version }}"%' mix.exs
sed -i 's%{:html_minifier, "~> [0-9\.]\+"}%{:html_minifier, "~> ${{ github.event.inputs.release-version }}"}%' README.md
- name: Publish to hex.pm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
run: |
mix hex.publish --yes
- uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v${{ github.event.inputs.release-version }}',
sha: context.sha
})