diff --git a/.github/workflows/build-cd.yml b/.github/workflows/build-cd.yml new file mode 100644 index 000000000..b879d2bda --- /dev/null +++ b/.github/workflows/build-cd.yml @@ -0,0 +1,85 @@ +name: indy-node-build-cd + +on: [push, workflow_dispatch] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + setup-workflow: + runs-on: ubuntu-latest + outputs: + CACHE_KEY_LINT: ${{ steps.cache.outputs.CACHE_KEY_LINT }} + CACHE_KEY_BUILD: ${{ steps.cache.outputs.CACHE_KEY_BUILD }} + # Expose the lowercase version of the GitHub repository name + # to all subsequent jobs that reference image repositories + # as the push and pull operations require the URL of the repository + # to be in lowercase. + GITHUB_REPOSITORY_NAME: ${{ steps.cache.outputs.GITHUB_REPOSITORY_NAME }} + PACKAGE_NAME: ${{ steps.init.outputs.PACKAGE_NAME }} + PACKAGE_VERSION: ${{ steps.init.outputs.PACKAGE_VERSION }} + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Set outputs + id: cache + run: | + echo "::set-output name=CACHE_KEY_LINT::${{ hashFiles('.github/workflows/lint/Dockerfile') }}" + echo "::set-output name=CACHE_KEY_BUILD::${{ hashFiles('.github/workflows/build/Dockerfile') }}" + echo "::set-output name=GITHUB_REPOSITORY_NAME::$(echo ${GITHUB_REPOSITORY})" + build-package: + needs: setup-workflow + runs-on: ubuntu-latest + env: + PACKAGE_NAME: ${{ needs.setup-workflow.outputs.PACKAGE_NAME }} + PACKAGE_VERSION: ${{ needs.setup-workflow.outputs.PACKAGE_VERSION }} + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Build package + run: | + cd build-scripts/ubuntu-1604 + # TODO: Cache the image, optimize scripts, remove default versions + ./build-indy-node-docker.sh "${PWD}/../.." 1.0.0 "${PWD}" + ls + - name: Archive package + uses: actions/upload-artifact@v2 + with: + name: indy-node-build-cd + path: build-scripts/ubuntu-1604/indy-node_1.0.0_amd64.deb + + publish-to-github: + needs: [setup-workflow, build-package] + runs-on: ubuntu-latest + env: + BRANCH_NAME: ${{ needs.setup-workflow.outputs.BRANCH_NAME }} + PACKAGE_NAME: ${{ needs.setup-workflow.outputs.PACKAGE_NAME }} + PACKAGE_VERSION: ${{ needs.setup-workflow.outputs.PACKAGE_VERSION }} + outputs: + PACKAGE_URL: ${{ steps.upload-release-asset.outputs.browser_download_url }} + steps: + - name: Restore package + uses: actions/download-artifact@v2 + with: + name: indy-node-build-cd + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.CR_PAT }} + with: + # TODO: Better naming + tag_name: ${{ env.PACKAGE_VERSION }}-${{ github.run_number }} + release_name: ${{ env.PACKAGE_VERSION }}-${{ github.run_number }} + body: new version ${{ env.PACKAGE_VERSION }}-${{ env.GITHUB_RUN_NUMBER }} release + draft: false + prerelease: false + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.CR_PAT }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }}_amd64.deb + asset_name: ${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }}_amd64.deb + asset_content_type: application/vnd.debian.binary-package + diff --git a/build-scripts/ubuntu-1604/Dockerfile b/build-scripts/ubuntu-1604/Dockerfile index 1c9f348eb..024adf6f6 100644 --- a/build-scripts/ubuntu-1604/Dockerfile +++ b/build-scripts/ubuntu-1604/Dockerfile @@ -19,7 +19,7 @@ RUN apt-get update -y && apt-get install -y \ # issues with pip>=10: # https://github.com/pypa/pip/issues/5240 # https://github.com/pypa/pip/issues/5221 -RUN python3 -m pip install -U pip setuptools \ +RUN python3 -m pip install -U pip==10.0.0 setuptools==20.7.0 \ && pip3 list # install fpm diff --git a/build-scripts/ubuntu-1604/build-indy-node-docker.sh b/build-scripts/ubuntu-1604/build-indy-node-docker.sh index f27b9bff6..8c9bf41f1 100755 --- a/build-scripts/ubuntu-1604/build-indy-node-docker.sh +++ b/build-scripts/ubuntu-1604/build-indy-node-docker.sh @@ -19,7 +19,7 @@ else fi docker build -t "${IMAGE_NAME}" -f Dockerfile . -docker volume create --name "${OUTPUT_VOLUME_NAME}" +# docker volume create --name "${OUTPUT_VOLUME_NAME}" docker run \ -i \