Skip to content

Commit

Permalink
Improve Digi-key token handling
Browse files Browse the repository at this point in the history
  • Loading branch information
eeintech committed Apr 13, 2023
1 parent 67a2c05 commit 59f6637
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions .github/workflows/test_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
INVENTREE_ENV: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TOKEN_DIGIKEY: ${{ secrets.TOKEN_DIGIKEY }}
DIGIKEY_CLIENT_ID: ${{ secrets.DIGIKEY_CLIENT_ID }}
DIGIKEY_CLIENT_SECRET: ${{ secrets.DIGIKEY_CLIENT_SECRET }}

continue-on-error: true
strategy:
Expand Down Expand Up @@ -87,41 +89,40 @@ jobs:
cat gui.log
export len_log=$(cat gui.log | wc -l)
[[ ${len_log} -eq 0 ]] && true || false
- name: Run tests
- name: Setup Digi-Key token
if: github.repository == 'sparkmicro/Ki-nTree'
run: |
git clone https://$TOKEN_DIGIKEY@github.com/eeintech/digikey-token.git
cp digikey-token/token_storage.json ~/.config/kintree/cache/
cd digikey-token/
python digikey_token_refresh.py
git config --global user.email "kintree@github.actions"
git config --global user.name "Ki-nTree Github Actions"
git add -u
git diff-index --quiet HEAD || git commit -m "Update token"
git push origin master
cp token_storage.json ~/.config/kintree/cache/
dk_token=$(cat ~/.config/kintree/cache/token_storage.json)
echo -e "Digi-Key Token: $dk_token\n"
cd ..
- name: Run tests
if: github.repository == 'sparkmicro/Ki-nTree'
run: |
invoke test -e 1
env:
DIGIKEY_CLIENT_ID: ${{ secrets.DIGIKEY_CLIENT_ID }}
DIGIKEY_CLIENT_SECRET: ${{ secrets.DIGIKEY_CLIENT_SECRET }}
MOUSER_PART_API_KEY: ${{ secrets.MOUSER_PART_API_KEY }}
ELEMENT14_PART_API_KEY: ${{ secrets.ELEMENT14_PART_API_KEY }}
- name: Run tests (skip APIs)
if: github.repository != 'sparkmicro/Ki-nTree'
run: |
invoke test -e 0
- name: Coveralls
run: |
coveralls --version
coveralls --service=github
- name: Run build
run: |
invoke build
- name: Push Digi-Key Token
- name: Coveralls
if: github.repository == 'sparkmicro/Ki-nTree'
run: |
cd digikey-token/
git pull
cp ~/.config/kintree/cache/token_storage.json .
git config --global user.email "kintree@github.actions"
git config --global user.name "Ki-nTree Github Actions"
git add -u
git diff-index --quiet HEAD || git commit -m "Updated token"
git push origin master
cd ..
coveralls --version
coveralls --service=github
test-publish:
name: Publish to Test PyPI, then PyPI
Expand Down

0 comments on commit 59f6637

Please sign in to comment.