Skip to content

Commit 2b5b138

Browse files
authored
Merge pull request #6 from esl/hex-release
Automatically publish new releases to Hex
2 parents 877078b + 55d084c commit 2b5b138

4 files changed

Lines changed: 57 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
otp_vsn: ['28', '27', '26']
17-
rebar_vsn: ['3.25.0']
17+
rebar_vsn: ['3.27.0']
1818
runs-on: 'ubuntu-24.04'
1919
steps:
2020
- uses: actions/checkout@v4

.github/workflows/release.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Publish to Hex
2+
3+
on:
4+
release:
5+
types: [ released ] # pre- and draft releases are excluded
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
- uses: erlef/setup-beam@v1
17+
with:
18+
otp-version: "28"
19+
rebar3-version: "3.27"
20+
- run: rebar3 compile
21+
- run: rebar3 hex publish -r hexpm --yes
22+
env:
23+
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Revert published version from Hex
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Package version to revert (e.g. 1.0.0)"
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
revert:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v6
19+
- uses: erlef/setup-beam@v1
20+
with:
21+
otp-version: "28"
22+
rebar3-version: "3.27"
23+
- run: rebar3 hex publish --revert ${{ inputs.version }} -r hexpm --yes
24+
env:
25+
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,11 @@ Allowed = opuntia:peek(Shaper),
2626
consume_tokens(Allowed),
2727
{NewShaper, 0} = opuntia:update(Shaper), %% Will suggest no delay if you were diligent and consume less that adviced
2828
```
29+
30+
## Releasing to Hex.pm
31+
32+
Creating a GitHub release (non-draft, non-prerelease) automatically publishes the package to [Hex.pm](https://hex.pm/) via the **Publish to Hex** workflow.
33+
This workflow can also be triggered manually from the Actions tabmake sure to run it from the specific tag you want to publish.
34+
35+
To revert a published version, run the **Revert published version from Hex** workflow from the Actions tab, providing the version to revert.
36+
Hex.pm only allows reverting within 1 hour of publishingafter that, the version can only be *retired*.

0 commit comments

Comments
 (0)