diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000000..8c6d17454276 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,71 @@ +# This is a basic workflow that is manually triggered + +name: Build + +on: + workflow_dispatch + +jobs: + generate-linux-image: + runs-on: ubuntu-latest + name: Generate Linux image + defaults: + run: + working-directory: ./artifacts + strategy: + matrix: + include: + - name: Linux x64 + ext: tar.gz + suffix: linux-x64 + script: build-platform --linux --skip-os-packages --release + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + path: ./artifacts + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: './artifacts/.nvmrc' + registry-url: 'https://registry.npmjs.org' + + - name: Setup Yarn + run: | + npm uninstall -g yarn + npm i -g yarn@1.22.10 + yarn config set network-timeout 1000000 -g + + - name: Configure Yarn Cache + run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV + + - name: Initialize Yarn Cache + uses: actions/cache@v3 + with: + path: ${{ env.YARN_CACHE_LOCATION }} + key: yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + yarn- + + - name: Get package version + run: | + echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV + + - name: Get artifact build name + run: | + echo "ARTIFACT_BUILD_NAME=opensearch-dashboards-${{ env.VERSION }}-${{ matrix.suffix }}.${{ matrix.ext }}" >> $GITHUB_ENV + + - name: Run bootstrap + run: yarn osd bootstrap + + - name: Build `${{ matrix.name }}` + run: yarn ${{ matrix.script }} --release + + - uses: actions/upload-artifact@v3 + if: success() + with: + name: ${{ matrix.suffix }}-${{ env.VERSION }} + path: ./artifacts/target/${{ env.ARTIFACT_BUILD_NAME }} + retention-days: 30 \ No newline at end of file