From b2a3ee74acf32d2c8087a885450cf859ed17bc9f Mon Sep 17 00:00:00 2001 From: Mike Pirog Date: Mon, 23 Aug 2021 17:26:35 -0400 Subject: [PATCH] #25: Attempt new build in leia tests --- .github/workflows/pr-apache-tests.yml | 4 +- .github/workflows/release.yml | 116 ++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-apache-tests.yml b/.github/workflows/pr-apache-tests.yml index 6ee9461e9..275e53d03 100644 --- a/.github/workflows/pr-apache-tests.yml +++ b/.github/workflows/pr-apache-tests.yml @@ -51,9 +51,9 @@ jobs: echo false > ~/.lando/cache/report_errors sed -i "s/report: true.*/report: false/" config.yml - name: Package CLI - run: yarn pkg + run: yarn build:cli - name: Replace source CLI with packaged one - run: sudo mv ./dist/* /usr/local/bin/lando + run: sudo mv ./dist/@lando/cli /usr/local/bin/lando - name: Verify we can run the packaged CLI run: | lando version diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 058c060df..5544c2ede 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -229,3 +229,119 @@ jobs: path: dist/@lando/signed if-no-files-found: error retention-days: 1 + + # Release to the various channels + deliver: + runs-on: ubuntu-20.04 + needs: + - sign-n-seal + env: + TERM: xterm + strategy: + matrix: + os: + - win + - macos + - linux + arch: + - x64 + - arm64 + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Download lando-cli-build-${{ github.sha }} + uses: actions/download-artifact@v2 + with: + name: lando-cli-build-${{ github.sha }} + path: dist/@lando + - name: Set helper variables + id: vars + env: + OS: ${{ matrix.os }} + shell: bash + run: | + # Set generic source ref vars + echo "::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}" + echo "::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}" + echo "::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}" + echo "::set-output name=SOURCE_ENDING::" + # Unset vars if it makes sense to do so + if [ "$GITHUB_REF" == "${GITHUB_REF#refs/tags/}" ]; then echo "::set-output name=SOURCE_TAG::"; fi + if [ "$GITHUB_REF" == "${GITHUB_REF#refs/heads/}" ]; then echo "::set-output name=SOURCE_BRANCH::"; fi + # Modify SOURCE_ENDING on win + if [ "$OS" == "win" ]; then echo '::set-output name=SOURCE_ENDING::.exe'; fi + - name: Test helper variables + shell: bash + run: | + echo "The source OS is ${{ matrix.os }}" + echo "The source Architecture is ${{ matrix.arch }}" + echo "The source name is ${{ steps.vars.outputs.SOURCE_NAME }}" + echo "The source branch is ${{ steps.vars.outputs.SOURCE_BRANCH }}" + echo "The source tag is ${{ steps.vars.outputs.SOURCE_TAG }}" + echo "The source ending is ${{ steps.vars.outputs.SOURCE_ENDING }}" + - name: Setup release buckets + shell: bash + run: | + ls -lsa dist/@lando + mkdir -p dist/releases dist/s3 dist/dev + - name: Name and sort releases + env: + SOURCE_BRANCH: ${{ steps.vars.outputs.SOURCE_BRANCH }} + SOURCE_TAG: ${{ steps.vars.outputs.SOURCE_TAG }} + SOURCE_PACKAGE: "lando-${{ matrix.os }}-${{ matrix.arch }}${{ steps.vars.outputs.SOURCE_ENDING }}" + DEST_PACKAGE: "lando-${{ matrix.os }}-${{ matrix.arch }}" + SOURCE_ENDING: ${{ steps.vars.outputs.SOURCE_ENDING }} + shell: bash + run: | + # Snapshot release + cp -f "dist/@lando/$SOURCE_PACKAGE" "dist/dev/$DEST_PACKAGE-build-${{ github.sha }}$SOURCE_ENDING" + + # S3 releases + cp -f "dist/@lando/$SOURCE_PACKAGE" "dist/s3/$DEST_PACKAGE-$SOURCE_BRANCH-latest$SOURCE_ENDING" + cp -f "dist/@lando/$SOURCE_PACKAGE" "dist/s3/$DEST_PACKAGE-$SOURCE_BRANCH-edge$SOURCE_ENDING" + if [[ "$SOURCE_BRANCH" == "main" ]]; then cp -f "dist/@lando/$SOURCE_PACKAGE" "dist/s3/$DEST_PACKAGE-latest$SOURCE_ENDING"; fi + if [[ "$SOURCE_BRANCH" == "main" ]]; then cp -f "dist/@lando/$SOURCE_PACKAGE" "dist/s3/$DEST_PACKAGE-edge$SOURCE_ENDING"; fi + if [ ! -z "$SOURCE_TAG" ]; then cp -f "dist/@lando/$SOURCE_PACKAGE" "dist/s3/$DEST_PACKAGE-stable$SOURCE_ENDING"; fi + if [ ! -z "$SOURCE_TAG" ]; then cp -f "dist/@lando/$SOURCE_PACKAGE" "dist/s3/$DEST_PACKAGE-$SOURCE_TAG$SOURCE_ENDING"; fi + + # GitHub Releases + if [ ! -z "$SOURCE_TAG" ]; then cp -f "dist/@lando/$SOURCE_PACKAGE" "dist/releases/$DEST_PACKAGE-$SOURCE_TAG$SOURCE_ENDING"; fi + + # Print what we end up with + ls -lsa dist/dev + ls -lsa dist/s3 + ls -lsa dist/releases + + # Upload snapshot releases as artifacts + - name: Upload snapshot releases + uses: actions/upload-artifact@v2 + with: + name: lando-cli-snapshot-releases-${{ github.sha }} + path: dist/dev + if-no-files-found: error + retention-days: 30 + + # Upload releases to S3 + - name: Configure S3 Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.S3_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.S3_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + - name: Upload releases to S3 + shell: bash + run: | + aws s3 sync dist/s3 s3://files.lando.dev/cli --acl public-read + aws s3 sync dist/s3 s3://files.lando.dev/lando --acl public-read + aws s3 sync dist/s3 s3://files.lando.dev/lando-cli --acl public-read + # Upload releases to GitHub Releases + - name: Upload releases to GitHub Releases + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + draft: true + files: dist/releases/lando-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.vars.outputs.SOURCE_TAG }}${{ steps.vars.outputs.SOURCE_ENDING }}