-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Automate publishing releases to hex.pm
- Loading branch information
1 parent
b2b4270
commit 88c855c
Showing
7 changed files
with
159 additions
and
61 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
elixir_version: | ||
required: true | ||
type: string | ||
otp_version: | ||
required: true | ||
type: string | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
publish-docs: | ||
name: Publish | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Erlang & Elixir | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
elixir-version: ${{ inputs.elixir_version }} | ||
otp-version: ${{ inputs.otp_version }} | ||
|
||
# Caching | ||
- name: Dependencies cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-deps-${{ hashFiles('mix.lock') }} | ||
|
||
- name: Build cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: _build | ||
key: ${{ runner.os }}-build-dev-${{inputs.elixir_version}}-${{inputs.otp_version}}-${{ hashFiles('mix.lock') }} | ||
|
||
# Run | ||
- name: Generate docs | ||
run: mix docs | ||
|
||
- name: Push docs | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
branch: gh-pages | ||
folder: doc |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# from https://github.com/elixir-mint/castore/blob/22d0a4efd41b97f55aab48e170f2520c338341b9/.github/workflows/publish.sh | ||
# by Eric Meadows-Jönsson (@ericmj) | ||
|
||
# Assume package name == repository name | ||
package="${GITHUB_REPOSITORY#*/}" | ||
|
||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
|
||
if [ $(git tag -l "v$(cat VERSION)") ]; then | ||
echo "NOT TAGGING" | ||
else | ||
echo "TAGGING" | ||
git tag "v$(cat VERSION)" | ||
git push --tags | ||
fi | ||
|
||
if mix hex.info $package "$(cat VERSION)"; then | ||
echo "NOT PUBLISHING" | ||
else | ||
echo "PUBLISHING" | ||
|
||
# Assumes HEX_API_KEY is set in GitHub Actions secrets | ||
# https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions | ||
mix hex.publish --yes | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# based on https://github.com/elixir-mint/castore/blob/22d0a4efd41b97f55aab48e170f2520c338341b9/.github/workflows/publish.yml | ||
# by Eric Meadows-Jönsson (@ericmj) | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
elixir_version: | ||
required: true | ||
type: string | ||
otp_version: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
publish-release: | ||
name: Publish | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Erlang & Elixir | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
elixir-version: ${{ inputs.elixir_version }} | ||
otp-version: ${{ inputs.otp_version }} | ||
|
||
# Caching | ||
- name: Dependencies cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-deps-${{ hashFiles('mix.lock') }} | ||
|
||
- name: Build cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: _build | ||
key: ${{ runner.os }}-build-dev-${{inputs.elixir_version}}-${{inputs.otp_version}}-${{ hashFiles('mix.lock') }} | ||
|
||
# Run | ||
- name: Publish release | ||
run: .github/workflows/publish-release.sh | ||
env: | ||
HEX_API_KEY: ${{ secrets.HEX_API_KEY }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0 |
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