From cfa4e5eb9902ea8f4581bc6cc8b0500056feaae3 Mon Sep 17 00:00:00 2001 From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> Date: Thu, 26 Nov 2020 00:07:38 -0500 Subject: ci: Move post deploy steps to main deploy script --- .github/workflows/deployment.yml | 70 +++++++++++++++++++++++++++++++++++++++ .github/workflows/post-deploy.yml | 37 --------------------- .vscode/settings.json | 1 + 3 files changed, 71 insertions(+), 37 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 04733a53..da03ef13 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -17,6 +17,8 @@ jobs: - name: Create artifacts directory run: mkdir artifacts + # TODO: Make this easier to test with. + - name: Get the release version from the tag if: env.VERSION == '' run: | @@ -303,3 +305,71 @@ jobs: asset_path: arch.tar.gz asset_name: arch.tar.gz asset_content_type: application/octet-stream + + additional-file-generation: + needs: [build-release] + name: additional-file-generation + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - uses: actions/setup-python@v2 + + - name: Get release download URL + uses: actions/download-artifact@v2 + with: + name: artifacts + path: artifacts + + - name: Set release upload URL and release version + shell: bash + run: | + release_upload_url="$(cat ./artifacts/release-upload-url)" + echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV + release_version="$(cat ./artifacts/release-version)" + echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV + + - name: Check release upload URL and release version + shell: bash + run: | + echo "release upload url: $RELEASE_UPLOAD_URL" + echo "release version: $RELEASE_VERSION" + + - name: Download packages + run: | + curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_x86_64-unknown-linux-gnu.tar.gz"; + curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_x86_64-apple-darwin.tar.gz"; + curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_i686-pc-windows-msvc.zip"; + curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_x86_64-pc-windows-msvc.zip"; + + - name: Execute choco packaging script + run: | + python "./deployment/windows/choco/choco_packager.py" "bottom_i686-pc-windows-msvc.zip" "bottom_x86_64-pc-windows-msvc.zip" $RELEASE_VERSION "./deployment/windows/choco/bottom.nuspec.template" "./deployment/windows/choco/chocolateyinstall.ps1.template" "bottom.nuspec" "tools/chocolateyinstall.ps1" "tools/" + zip -r choco.zip "bottom.nuspec" "tools" + + - name: Upload choco.zip to release + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ env.RELEASE_UPLOAD_URL }} + asset_path: choco.zip + asset_name: choco.zip + asset_content_type: application/octet-stream + + - name: Execute Homebrew packaging script + run: | + python "./deployment/packager.py" $RELEASE_VERSION "./deployment/macos/homebrew/bottom.rb.template" "./bottom.rb" "SHA256" "./bottom_x86_64-apple-darwin.tar.gz" "./bottom_x86_64-unknown-linux-gnu.tar.gz"; + + - name: Upload bottom.rb to release + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ env.RELEASE_UPLOAD_URL }} + asset_path: bottom.rb + asset_name: bottom.rb + asset_content_type: application/octet-stream diff --git a/.github/workflows/post-deploy.yml b/.github/workflows/post-deploy.yml index 9f7ff103..425fe299 100644 --- a/.github/workflows/post-deploy.yml +++ b/.github/workflows/post-deploy.yml @@ -4,8 +4,6 @@ on: release: types: [published] -# TODO: Move the homebrew and choco steps back to the main deployment script. - jobs: post-deploy: runs-on: ubuntu-latest @@ -25,41 +23,6 @@ jobs: exit 1 fi - - name: Download packages - run: | - curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_x86_64-unknown-linux-gnu.tar.gz"; - curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_x86_64-apple-darwin.tar.gz"; - curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_i686-pc-windows-msvc.zip"; - curl -LO "https://github.com/ClementTsang/bottom/releases/download/$RELEASE_VERSION/bottom_x86_64-pc-windows-msvc.zip"; - - - name: Execute choco packaging script - run: | - python "./deployment/windows/choco/choco_packager.py" "bottom_i686-pc-windows-msvc.zip" "bottom_x86_64-pc-windows-msvc.zip" $RELEASE_VERSION "./deployment/windows/choco/bottom.nuspec.template" "./deployment/windows/choco/chocolateyinstall.ps1.template" "./deployment/windows/choco/bottom.nuspec" "./deployment/windows/choco/tools/chocolateyinstall.ps1" "./deployment/windows/choco/tools/" - cd ./deployment/windows/choco - zip -r choco.zip "bottom.nuspec" "tools" - cd ../../../ - cp ./deployment/windows/choco/choco.zip . - - - name: Upload choco.zip to release - uses: svenstaro/upload-release-action@2.1.0 - with: - repo_token: ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }} - file: choco.zip - tag: ${{ env.RELEASE_VERSION }} - overwrite: true - - - name: Execute Homebrew packaging script - run: | - python "./deployment/packager.py" $RELEASE_VERSION "./deployment/macos/homebrew/bottom.rb.template" "./bottom.rb" "SHA256" "./bottom_x86_64-apple-darwin.tar.gz" "./bottom_x86_64-unknown-linux-gnu.tar.gz"; - - - name: Upload bottom.rb to release - uses: svenstaro/upload-release-action@2.1.0 - with: - repo_token: ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }} - file: bottom.rb - tag: ${{ env.RELEASE_VERSION }} - overwrite: true - - name: Trigger homebrew run: | curl -X POST https://api.github.com/repos/ClementTsang/homebrew-bottom/dispatches \ diff --git a/.vscode/settings.json b/.vscode/settings.json index 2ec8a939..5decc229 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -39,6 +39,7 @@ "atim", "autohide", "choco", + "chocolateyinstall", "cmdline", "commandline", "concat", -- cgit v1.2.3