|  | 
|  | 1 | +name: Release Actions | 
|  | 2 | + | 
|  | 3 | +on: | 
|  | 4 | +  release: | 
|  | 5 | +    types: [published] | 
|  | 6 | + | 
|  | 7 | +jobs: | 
|  | 8 | +  upload-release-assets: | 
|  | 9 | +    runs-on: ubuntu-latest | 
|  | 10 | +    steps: | 
|  | 11 | +    - name: Dump GitHub context | 
|  | 12 | +      env: | 
|  | 13 | +        GITHUB_CONTEXT: ${{ toJson(github) }} | 
|  | 14 | +      run: echo "$GITHUB_CONTEXT" | 
|  | 15 | +    - name: Translate Repo Name For Build Tools filename_prefix | 
|  | 16 | +      id: repo-name | 
|  | 17 | +      run: | | 
|  | 18 | +        echo ::set-output name=repo-name::$( | 
|  | 19 | +        echo ${{ github.repository }} | | 
|  | 20 | +        awk -F '\/' '{ print tolower($2) }' | | 
|  | 21 | +        tr '_' '-' | 
|  | 22 | +        ) | 
|  | 23 | +    - name: Set up Python 3.6 | 
|  | 24 | +      uses: actions/setup-python@v1 | 
|  | 25 | +      with: | 
|  | 26 | +        python-version: 3.6 | 
|  | 27 | +    - name: Versions | 
|  | 28 | +      run: | | 
|  | 29 | +        python3 --version | 
|  | 30 | +    - name: Checkout Current Repo | 
|  | 31 | +      uses: actions/checkout@v1 | 
|  | 32 | +      with: | 
|  | 33 | +        submodules: true | 
|  | 34 | +    - name: Checkout tools repo | 
|  | 35 | +      uses: actions/checkout@v2 | 
|  | 36 | +      with: | 
|  | 37 | +        repository: adafruit/actions-ci-circuitpython-libs | 
|  | 38 | +        path: actions-ci | 
|  | 39 | +    - name: Install deps | 
|  | 40 | +      run: | | 
|  | 41 | +        source actions-ci/install.sh | 
|  | 42 | +    - name: Build assets | 
|  | 43 | +      run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . | 
|  | 44 | +    - name: Upload Release Assets | 
|  | 45 | +      # the 'official' actions version does not yet support dynamically | 
|  | 46 | +      # supplying asset names to upload. @csexton's version chosen based on | 
|  | 47 | +      # discussion in the issue below, as its the simplest to implement and | 
|  | 48 | +      # allows for selecting files with a pattern. | 
|  | 49 | +      # https://github.com/actions/upload-release-asset/issues/4 | 
|  | 50 | + | 
|  | 51 | +      uses: csexton/release-asset-action@master | 
|  | 52 | +      with: | 
|  | 53 | +        pattern: "bundles/*" | 
|  | 54 | +        github-token: ${{ secrets.GITHUB_TOKEN }} | 
|  | 55 | + | 
|  | 56 | +  upload-pypi: | 
|  | 57 | +    runs-on: ubuntu-latest | 
|  | 58 | +    steps: | 
|  | 59 | +    - uses: actions/checkout@v1 | 
|  | 60 | +    - name: Check For setup.py | 
|  | 61 | +      id: need-pypi | 
|  | 62 | +      run: | | 
|  | 63 | +        echo ::set-output name=setup-py::$( find . -wholename './setup.py' ) | 
|  | 64 | +    - name: Set up Python | 
|  | 65 | +      if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') | 
|  | 66 | +      uses: actions/setup-python@v1 | 
|  | 67 | +      with: | 
|  | 68 | +        python-version: '3.x' | 
|  | 69 | +    - name: Install dependencies | 
|  | 70 | +      if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') | 
|  | 71 | +      run: | | 
|  | 72 | +        python -m pip install --upgrade pip | 
|  | 73 | +        pip install setuptools wheel twine | 
|  | 74 | +    - name: Build and publish | 
|  | 75 | +      if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') | 
|  | 76 | +      env: | 
|  | 77 | +        TWINE_USERNAME: ${{ secrets.pypi_username }} | 
|  | 78 | +        TWINE_PASSWORD: ${{ secrets.pypi_password }} | 
|  | 79 | +      run: | | 
|  | 80 | +        python setup.py sdist | 
|  | 81 | +        twine upload dist/* | 
0 commit comments