feat: add a few robustness-es features around htx submission #188
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Artifacts | |
| on: | |
| push: | |
| paths: | |
| - 'artifacts/**' | |
| - '!artifacts/core/**' | |
| - 'cvm-agent/**' | |
| branches: | |
| - main | |
| tags: | |
| - 'nilcc-artifacts-*' | |
| pull_request: | |
| paths: | |
| - 'artifacts/**' | |
| - '!artifacts/core/**' | |
| - 'cvm-agent/**' | |
| permissions: | |
| id-token: write | |
| contents: read | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: 'true' | |
| - name: Generate version | |
| run: | | |
| if [[ "$GITHUB_REF" =~ ^refs/tags/nilcc-artifacts-.* ]]; then | |
| # Remove the 'refs/tags/nilcc-artifacts-' prefix and keep the version | |
| version=${GITHUB_REF:26} | |
| else | |
| # Or the short git hash otherwise. | |
| version=$(git rev-parse --short HEAD) | |
| fi | |
| echo "Building version ${version}" | |
| echo "NILCC_VERSION=${version}" >> $GITHUB_ENV | |
| - name: Install dependencies | |
| run: | | |
| sudo apt install -y --no-install-recommends jq squashfs-tools cloud-image-utils qemu-system-x86 | |
| - name: Install rust toolchain | |
| uses: dtolnay/[email protected] | |
| - name: Build cvm-agent | |
| run: cargo build --release -p cvm-agent | |
| - name: Build initrd | |
| run: artifacts/initramfs/build.sh | |
| - name: Build guest cpu disk | |
| env: | |
| NILCC_VERSION: ${{ env.NILCC_VERSION }} | |
| run: artifacts/cvm-image/build.sh cpu | |
| - name: Build guest gpu disk | |
| env: | |
| NILCC_VERSION: ${{ env.NILCC_VERSION }} | |
| run: artifacts/cvm-image/build.sh gpu | |
| - name: Generate build metadata | |
| run: | | |
| ./artifacts/generate-metadata.sh | |
| hash=$(sha256sum artifacts/dist/metadata.json | cut -d " " -f 1) | |
| echo "Metadata hash: ${hash}" >> $GITHUB_STEP_SUMMARY | |
| - name: Configure AWS credentials | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: "arn:aws:iam::592920173613:role/github-runners-productionnilcc-ci-nilcc-bucket" | |
| aws-region: eu-west-1 | |
| - name: Publish | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') | |
| run: | | |
| ./artifacts/upload.sh "${{ env.NILCC_VERSION }}" | |