Skip to content

Commit

Permalink
Merge pull request #6 from dhalbert/update-workflow
Browse files Browse the repository at this point in the history
update workflows
  • Loading branch information
FoamyGuy authored Oct 30, 2023
2 parents 8b9c897 + d120f56 commit e75af57
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 41 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Set up Python 3.6
uses: actions/setup-python@v1
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.6
python-version: 3.11
- name: Versions
run: |
python3 --version
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
submodules: true
- name: Fetch correct submodule shas
run: git submodule foreach 'git fetch --tags --depth 1 origin $sha1 && git checkout -q $sha1'
- name: Install deps
run: |
sudo apt-get install -y gettext gawk
Expand Down
51 changes: 26 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,48 @@ jobs:
upload-release-assets:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo ::set-output name=repo-name::$(
echo "repo-name=$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.6
uses: actions/setup-python@v1
)" >> $GITHUB_OUTPUT
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.6
python-version: 3.11
- name: Versions
run: |
python3 --version
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
submodules: true
- name: Fetch correct submodule shas
run: git submodule foreach 'git fetch --tags --depth 1 origin $sha1 && git checkout -q $sha1'
- name: Install deps
run: |
sudo apt-get install -y gettext gawk
pip install -r requirements.txt
- name: Package Folder Prefix For circuitpython-build-tools (Community Bundle Specific)
id: pkg-folder
run: |
echo prefix=$(
ls -RUx |
gawk -F '\n' '{ match($1, /(drivers|helpers)\/(.+)\/(.+)\:/, arr) ; if (length(arr[0]) > 0 && match(arr[3], arr[2]) > 0) printf "%s, ", arr[3] }' |
gawk '{ trimmed = substr($0, 1, length($0) - 2) ; print "\"" trimmed "\"" }'
) >> $GITHUB_OUTPUT
- name: Build assets
run: ./build.sh
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location libraries --library_depth 2 --package_folder_prefix ${{ steps.pkg-folder.outputs.prefix }}
- name: Upload Release Assets
# the 'official' actions version does not yet support dynamically
# supplying asset names to upload. @csexton's version chosen based on
# discussion in the issue below, as its the simplest to implement and
# allows for selecting files with a pattern.
# https://github.com/actions/upload-release-asset/issues/4
#uses: actions/upload-release-asset@v1.0.1
uses: csexton/release-asset-action@master
uses: shogo82148/actions-upload-release-asset@v1
with:
pattern: "bundles/*"
github-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Upload Assets To AWS S3
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bundles/ s3://adafruit-circuit-python/bundles/community --recursive --no-progress --region us-east-1"
asset_path: "bundles/*"
github_token: ${{ secrets.GITHUB_TOKEN }}
upload_url: ${{ github.event.release.upload_url }}
- name: Upload Assets To AWS S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bundles/ s3://adafruit-circuit-python/bundles/community --recursive --no-progress --region us-east-1"
10 changes: 2 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,8 @@ set -e

P=$(
ls -RUx |
gawk -F '\n' '{ match($1, /(drivers|helpers)\/(.+)\/(.+)\:/, arr) ; if (length(arr[0]) > 0 && match(arr[3], arr[2]) > 0) printf "%s, ", arr[3] }' |
gawk -F '\n' '{ match($1, /(drivers|helpers)\/(.+)\/(.+):/, arr) ; if (length(arr[0]) > 0 && match(arr[3], arr[2]) > 0) printf "%s, ", arr[3] }' |
gawk '{ trimmed = substr($0, 1, length($0) - 2) ; print "\"" trimmed "\"" }'
)

if [ -z "$P" ]; then
P=""
else
P="--package_folder_prefix $P"
fi

circuitpython-build-bundles --filename_prefix circuitpython-org-bundle --library_location libraries --library_depth 2 $P
circuitpython-build-bundles --filename_prefix circuitpython-org-bundle --library_location libraries --library_depth 2 --package_folder_prefix "$P"

0 comments on commit e75af57

Please sign in to comment.