From a2dee86acbbaaf014fcfa4d6ca2c46c280bef234 Mon Sep 17 00:00:00 2001 From: flatsiedatsie Date: Tue, 20 Dec 2022 12:50:56 +0100 Subject: [PATCH] Create release.yml --- .github/workflows/release.yml | 94 +++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8561a8a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,94 @@ +name: Release + +on: + release: + types: [created] + +jobs: + get-release: + runs-on: ubuntu-latest + steps: + - name: Get Release + id: get_release + uses: bruceadams/get-release@v1.2.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Dump upload url to file + run: echo '${{ steps.get_release.outputs.upload_url }}' > upload_url + - name: Upload upload_url + uses: actions/upload-artifact@v1 + with: + name: upload_url + path: upload_url + + build: + needs: get-release + strategy: + matrix: + platform: [ + 'linux-arm', + 'linux-arm64', + #'linux-x64', + ] + pair: [ + #'python:3.7', + 'python:3.9', + ] + include: + - platform: 'linux-arm' + host-os: 'ubuntu-latest' + - platform: 'linux-arm64' + host-os: 'ubuntu-latest' + #- platform: 'linux-x64' + # host-os: 'ubuntu-latest' + #- pair: 'python:3.7' + # language: 'python' + # version: '3.7' + - pair: 'python:3.9' + language: 'python' + version: '3.9' + + runs-on: ${{ matrix.host-os }} + + steps: + - name: Download upload_url + uses: actions/download-artifact@v1 + with: + name: upload_url + - name: Set upload_url + run: echo "UPLOAD_URL=$(cat upload_url/upload_url)" >> $GITHUB_ENV + - name: Set release version + run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV + - uses: actions/checkout@v2 + - name: Use Python ${{ matrix.version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.version }} + - name: Make build script executable + run: chmod +x ./build.sh + - name: Make packaging script executable + run: chmod +x ./package.sh + - name: Build adapter + run: | + ./build.sh "${{ matrix.platform }}" "${{ matrix.language }}" "${{ matrix.version }}" + shell: bash + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ env.UPLOAD_URL }} + asset_path: matter-adapter-${{ env.RELEASE_VERSION }}-${{ matrix.platform }}-v${{ matrix.version }}.tgz + asset_name: matter-adapter-${{ env.RELEASE_VERSION }}-${{ matrix.platform }}-v${{ matrix.version }}.tgz + asset_content_type: application/zip + - name: Upload Release Asset Checksum + id: upload-release-asset-checksum + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ env.UPLOAD_URL }} + asset_path: matter-adapter-${{ env.RELEASE_VERSION }}-${{ matrix.platform }}-v${{ matrix.version }}.tgz.sha256sum + asset_name: matter-adapter-${{ env.RELEASE_VERSION }}-${{ matrix.platform }}-v${{ matrix.version }}.tgz.sha256sum + asset_content_type: text/plain