-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup GitHub Actions Package Publish (#9)
- Loading branch information
Showing
5 changed files
with
151 additions
and
0 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 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,105 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
otpVersion: | ||
required: true | ||
type: string | ||
elixirVersion: | ||
required: true | ||
type: string | ||
releaseName: | ||
required: false | ||
type: string | ||
secrets: | ||
HEX_API_KEY: | ||
required: false | ||
|
||
name: "Publish" | ||
|
||
jobs: | ||
hex_publish: | ||
name: mix hex.publish | ||
|
||
runs-on: ubuntu-latest | ||
|
||
if: "${{ inputs.releaseName }}" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: erlef/setup-beam@v1 | ||
id: setupBEAM | ||
with: | ||
otp-version: ${{ inputs.otpVersion }} | ||
elixir-version: ${{ inputs.elixirVersion }} | ||
- uses: actions/cache@v3 | ||
with: | ||
path: _build | ||
key: mix_hex_publish-build-${{ runner.os }}-${{ steps.setupBEAM.outputs.otp-version }}-${{ hashFiles('mix.exs') }} | ||
restore-keys: | | ||
mix_hex_publish-build-${{ runner.os }}-${{ steps.setupBEAM.outputs.otp-version }}- | ||
- uses: actions/cache@v3 | ||
with: | ||
path: deps | ||
key: mix_hex_publish-deps-${{ runner.os }}-${{ steps.setupBEAM.outputs.otp-version }}-${{ hashFiles('mix.exs') }} | ||
restore-keys: | | ||
mix_hex_publish-deps-${{ runner.os }}-${{ steps.setupBEAM.outputs.otp-version }}- | ||
- run: mix deps.get | ||
- run: mix hex.publish --yes | ||
env: | ||
HEX_API_KEY: ${{ secrets.HEX_API_KEY }} | ||
|
||
hex_build: | ||
name: mix hex.build | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: erlef/setup-beam@v1 | ||
id: setupBEAM | ||
with: | ||
otp-version: ${{ inputs.otpVersion }} | ||
elixir-version: ${{ inputs.elixirVersion }} | ||
- uses: actions/cache@v3 | ||
with: | ||
path: _build | ||
key: mix_hex_build-build-${{ runner.os }}-${{ steps.setupBEAM.outputs.otp-version }}-${{ hashFiles('mix.exs') }} | ||
restore-keys: | | ||
mix_hex_build-build-${{ runner.os }}-${{ steps.setupBEAM.outputs.otp-version }}- | ||
- uses: actions/cache@v3 | ||
with: | ||
path: deps | ||
key: mix_hex_build-deps-${{ runner.os }}-${{ steps.setupBEAM.outputs.otp-version }}-${{ hashFiles('mix.exs') }} | ||
restore-keys: | | ||
mix_hex_build-deps-${{ runner.os }}-${{ steps.setupBEAM.outputs.otp-version }}- | ||
- run: mix deps.get | ||
- run: mix hex.build --output package.tar | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: package | ||
path: package.tar | ||
|
||
upload: | ||
name: "Upload" | ||
|
||
runs-on: ubuntu-latest | ||
|
||
if: ${{ inputs.releaseName }} | ||
|
||
needs: ["hex_build"] | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: package | ||
path: . | ||
- name: Upload | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: | | ||
gh release upload --clobber "${{ inputs.releaseName }}" \ | ||
package.tar |
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 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 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