ugh #34
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: Build web image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*" | |
| paths: | |
| - "web/**" | |
| - "helm/**" | |
| - "replicated/**" | |
| - ".github/workflows/build-web.yaml" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=ref,event=branch | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha,prefix=sha-,format=short | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./web | |
| file: ./web/Containerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| env: | |
| REPLICATED_API_TOKEN: ${{ secrets.REPLICATED_API_TOKEN }} | |
| REPLICATED_APP: bootcamp | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4 | |
| - name: Install Replicated CLI | |
| run: | | |
| VERSION=$(curl -fs https://api.github.com/repos/replicatedhq/replicated/releases/latest \ | |
| | grep '"tag_name"' | cut -d'"' -f4) | |
| curl -fsSL "https://github.com/replicatedhq/replicated/releases/download/${VERSION}/replicated_${VERSION#v}_linux_amd64.tar.gz" \ | |
| | tar xz -C /tmp replicated | |
| sudo mv /tmp/replicated /usr/local/bin/ | |
| - name: Package release artifacts | |
| run: ./replicated/prepare.sh | |
| - name: Determine channel and version | |
| id: vars | |
| run: | | |
| if [[ "${{ github.ref_type }}" == "tag" ]]; then | |
| echo "channel=Stable" >> "$GITHUB_OUTPUT" | |
| echo "version=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "channel=Unstable" >> "$GITHUB_OUTPUT" | |
| echo "version=0.0.${{ github.run_number }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Create and promote release | |
| run: | | |
| replicated release create \ | |
| --yaml-dir ./replicated \ | |
| --promote "${{ steps.vars.outputs.channel }}" \ | |
| --version "${{ steps.vars.outputs.version }}" |