-
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.
- Loading branch information
Showing
4 changed files
with
131 additions
and
2 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,46 @@ | ||
name: Publish Package | ||
on: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
OPENAI_API_KEY: afakekeyneededfortests | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Elixir | ||
uses: erlef/setup-beam@61e01a43a562a89bfc54c7f9a378ff67b03e4a21 # v1.16.0 | ||
with: | ||
elixir-version: '1.16.0' # [Required] Define the Elixir version | ||
otp-version: '26.2' # [Required] Define the Erlang/OTP version | ||
- name: Restore dependencies cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: ${{ runner.os }}-mix- | ||
- name: Restore _build cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: _build | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/*.ex') }} | ||
restore-keys: ${{ runner.os }}-build- | ||
- name: Install dependencies | ||
run: mix deps.get | ||
- name: Check version | ||
run: | | ||
MIX_VERSION=$(grep 'version:' mix.exs | cut -d '"' -f2) | ||
TAG_VERSION=${GITHUB_REF/refs\/tags\/v/} | ||
if [ "$MIX_VERSION" != "$TAG_VERSION" ]; then | ||
echo "Tag version ($TAG_VERSION) does not match mix.exs version ($MIX_VERSION)" | ||
exit 1 | ||
fi | ||
- name: Publish to Hex | ||
uses: synchronal/hex-publish-action@v3 | ||
with: | ||
name: gpt_agent | ||
key: ${{ secrets.HEX_API_KEY }} | ||
tag-release: false |
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,56 @@ | ||
#!/usr/bin/env sh | ||
|
||
# This script is used to integrate your local changes with the remote | ||
# repository. See the documentation in the pre-commit-sample file for | ||
# information on what we check prior to committing and pushing your changes. | ||
# This script is intended as a convenient one-liner to commit your changes, push | ||
# them to the remote repository, and watch the GitHub Actions workflow run in | ||
# your terminal to ensure that the build is successful. | ||
|
||
set -e | ||
|
||
if [ ! -e ./.git/hooks/pre-commit ]; then | ||
ln -s ../../pre-commit-sample ./.git/hooks/pre-commit | ||
else | ||
if [ "$(readlink -f ./.git/hooks/pre-commit)" != "$(readlink -f ./pre-commit-sample)" ]; then | ||
echo "\n\n" | ||
echo "\e[1;31m" | ||
echo "**********************************************************************" | ||
echo "* Error: pre-commit hook conflict *" | ||
echo "* *" | ||
echo "* You have an existing pre-commit hook at ./.git/hooks/pre-commit, so *" | ||
echo "* we will not install the hook required by this script. Please *" | ||
echo "* review the hook in ./pre-commit-sample and consider removing your *" | ||
echo "* current pre-commit hook. *" | ||
echo "**********************************************************************" | ||
echo "\e[0m" | ||
echo "\n\n" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
git add -N . | ||
git add -p | ||
git commit --no-verify -m "TEMPORARY UNTESTED COMMIT\n\nIf you are seeing this in the commit log, it probably means that the integrate.sh script failed. You should do a soft reset to the commit prior to this commit." | ||
|
||
if git diff --exit-code; then | ||
echo "No uncommitted changes to stash" | ||
changes_stashed=0 | ||
else | ||
echo "Stashing uncommitted changes" | ||
changes_stashed=1 | ||
git restore --staged . | ||
git stash push --include-untracked -m "Temporary stash for uncommitted changes" | ||
fi | ||
|
||
git pull --rebase | ||
git reset --soft HEAD^ | ||
git status | ||
mix clean | ||
git commit | ||
git push | ||
if [ $changes_stashed -eq 1 ]; then | ||
git stash pop | ||
fi | ||
sleep 2 | ||
gh run watch --exit-status |
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,23 @@ | ||
#!/usr/bin/env sh | ||
|
||
exec 1>&2 | ||
|
||
if ! git diff --exit-code; then | ||
echo "\n\n" | ||
echo "\e[1;31m" | ||
echo "**********************************************************************" | ||
echo "* Error: There are unstaged changes! *" | ||
echo "* *" | ||
echo "* You must run your pre-commit tests against the same code that will *" | ||
echo "* actually be commited, and the presence of unstaged changes will *" | ||
echo "* prevent that. We recommend using the integrate.sh script in this *" | ||
echo "* repository to take care of automatically stashing these changes *" | ||
echo "* for you. *" | ||
echo "**********************************************************************" | ||
echo "\e[0m" | ||
echo "\n\n" | ||
exit 1 | ||
fi | ||
|
||
mix check && \ | ||
mix test |