Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ name: Release
# 3. publishes to Hex (needs the HEX_API_KEY secret) and creates the GitHub
# release with that version's changelog as its notes.
#
# Publish is safe to retry with "Re-run failed jobs": it reuses the tag and
# skips what already went out. Release durable before a durable_dashboard
# If publishing fails, run Release again with the same version: a tag that
# isn't on Hex yet is reused, and publish skips what already went out. Release durable before a durable_dashboard
# that needs its changes, since the dashboard resolves durable from Hex.

on:
Expand Down Expand Up @@ -67,20 +67,24 @@ jobs:
echo "::error::'$version' is not a semantic version"; exit 1
fi
if git rev-parse -q --verify "refs/tags/$tag" > /dev/null; then
echo "::error::$tag already exists"; exit 1
if curl -sfo /dev/null "https://hex.pm/api/packages/$PACKAGE/releases/$version"; then
echo "::error::$tag is already on Hex"; exit 1
fi
# Tagged by a run that failed to publish: publish that tag.
echo "::notice::$tag exists but isn't on Hex yet, publishing it"
else
sed -i -E "s/^([[:space:]]*@version )\"[^\"]+\"/\1\"$version\"/" "$PACKAGE/mix.exs"
grep -q "@version \"$version\"" "$PACKAGE/mix.exs"
cliff --tag "$tag" --output "$PACKAGE/CHANGELOG.md"

git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add "$PACKAGE/mix.exs" "$PACKAGE/CHANGELOG.md"
git commit -m "chore($PACKAGE): release $version"
git tag -a "$tag" -m "$PACKAGE $version"
git push --atomic origin HEAD:main "$tag"
fi

sed -i -E "s/^([[:space:]]*@version )\"[^\"]+\"/\1\"$version\"/" "$PACKAGE/mix.exs"
grep -q "@version \"$version\"" "$PACKAGE/mix.exs"
cliff --tag "$tag" --output "$PACKAGE/CHANGELOG.md"

git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add "$PACKAGE/mix.exs" "$PACKAGE/CHANGELOG.md"
git commit -m "chore($PACKAGE): release $version"
git tag -a "$tag" -m "$PACKAGE $version"
git push --atomic origin HEAD:main "$tag"

echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "version=$version" >> "$GITHUB_OUTPUT"

Expand Down Expand Up @@ -108,6 +112,11 @@ jobs:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}

# Before the JS deps: assets/package.json links phoenix and LiveView
# from deps/.
- name: Install dependencies
run: mix deps.get

- name: Set up pnpm
if: inputs.package == 'durable_dashboard'
uses: pnpm/action-setup@v6
Expand All @@ -130,9 +139,7 @@ jobs:
# Against Hex deps, as users get it: catches a dashboard that needs an
# unreleased durable.
- name: Compile
run: |
mix deps.get
mix compile --warnings-as-errors
run: mix compile --warnings-as-errors

- name: Publish to Hex
env:
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ conventional commits since its last tag, or enter one. The workflow:
2. publishes to Hex with the `HEX_API_KEY` repository secret;
3. creates the GitHub release, with that version's changelog as its notes.

If publishing fails, "Re-run failed jobs" retries it for the same tag. Release
If publishing fails, run Release again with the same version: it reuses the
tag and skips whatever already went out. Release
`durable` first when the dashboard needs its changes: the dashboard is
published against durable from Hex.

Expand Down
2 changes: 1 addition & 1 deletion durable_dashboard/mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"crontab": {:hex, :crontab, "1.2.1", "17991605725002e8dd949b95c1460b757b0702c048a7c9ea8b03183d08d3b9a9", [:mix], [{:ecto, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "ab550a005380d30c05038a1abff66989591e7703b2cc0d83f446a86fab258150"},
"db_connection": {:hex, :db_connection, "2.10.2", "ae391e803a5adff104da913c2fc1c0c14a37f8b10001dcef568796e1fb7bf95c", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "510b14482330f1af6490a2fa0efd8d4f1435d1529b165647df22ac0f2df0fa93"},
"decimal": {:hex, :decimal, "3.2.0", "f1235f05d841a211fda78a08fdb9777f2ff51a71f18455233fae186ff76187c6", [:mix], [], "hexpm", "190bca80580ce61aa69bb0eacadd7677710205c770225c2c2c07e32a5c31b234"},
"durable": {:hex, :durable, "0.1.0-rc", "641e535081348ec56689f72b305a55add2efc43ce8bd8ef9074045be117cadef", [:mix], [{:crontab, "~> 1.1", [hex: :crontab, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.12", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:igniter, "~> 0.6", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:nimble_options, "~> 1.1", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.3", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "385faed89685d5a8f1f38ea3ce5751fa9477a1ca8fa14441b68b229f306ff6f6"},
"durable": {:hex, :durable, "1.0.0", "db744517b4761eef1d11531368ba8a71e17a5fe019d4bb596850423dc265ee68", [:mix], [{:crontab, "~> 1.1", [hex: :crontab, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.12", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:igniter, "~> 0.6", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:nimble_options, "~> 1.1", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.3", [hex: :telemetry, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: true]}], "hexpm", "c974f9cf31890497d84e6b7a1ca5751141998191e8ba37ec522015935a5ac142"},
"earmark_parser": {:hex, :earmark_parser, "1.4.45", "cba8369ab2a1342e419bc2760eec731b17be828941dcf494045d44766227e1d5", [:mix], [], "hexpm", "d3ec045bf122965db20c0bdb420e19ee1415843135327124918473feb4b328e8"},
"ecto": {:hex, :ecto, "3.14.2", "99db28a864293a789c970651de711e3cae184291e0e7ea1166c54055ac41c1f3", [:mix], [{:decimal, "~> 3.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "25d60b8c816a07d19d85b80bdf60978bd8b102209dda198d768cd7c6745339a6"},
"ecto_sql": {:hex, :ecto_sql, "3.14.0", "06446ab8410d2f85bfbb80857ee224ab3b693700cbb38f6535d507449a627b2e", [:mix], [{:db_connection, "~> 2.9", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 3.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.14.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.8", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f4d8d36faf294c9417b5a37ec7ac8217ee2abdef5fcf197ba690f361548d3949"},
Expand Down
Loading