-
Notifications
You must be signed in to change notification settings - Fork 26
move release to github actions #664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*.*.*' | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| validate: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Verify tag is from main branch | ||
| run: | | ||
| git fetch origin main | ||
| if ! git merge-base --is-ancestor ${{ github.sha }} origin/main; then | ||
| echo "Error: Tag must be created from main branch" | ||
| exit 1 | ||
| fi | ||
marccampbell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| test: | ||
| runs-on: ubuntu-24.04 | ||
| needs: validate | ||
| strategy: | ||
| matrix: | ||
| test-type: [unit, pact, integration] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '^1.24' | ||
| - uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cache/go-build | ||
| ~/go/pkg/mod | ||
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-go- | ||
| - name: Install pact | ||
| if: matrix.test-type == 'pact' | ||
| uses: replicatedhq/action-install-pact@v1 | ||
| - name: Run tests | ||
| run: make test-${{ matrix.test-type }} | ||
|
|
||
| release: | ||
| runs-on: ubuntu-24.04 | ||
| needs: test | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '^1.24' | ||
| - name: Run GoReleaser | ||
| uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| distribution: goreleaser | ||
| version: v2.10.2 | ||
| args: release --clean | ||
marccampbell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
marccampbell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| docker: | ||
| runs-on: ubuntu-24.04 | ||
| needs: release | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USER }} | ||
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
| - name: Extract version | ||
| id: version | ||
| run: | | ||
| VERSION=${GITHUB_REF#refs/tags/v} | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| echo "major=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_OUTPUT | ||
| echo "minor=$(echo $VERSION | cut -d. -f1,2)" >> $GITHUB_OUTPUT | ||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| push: true | ||
| tags: | | ||
| replicated/vendor-cli:latest | ||
| replicated/vendor-cli:${{ steps.version.outputs.major }} | ||
| replicated/vendor-cli:${{ steps.version.outputs.minor }} | ||
| replicated/vendor-cli:${{ steps.version.outputs.version }} | ||
| labels: | | ||
| com.replicated.vendor_cli=true | ||
| platforms: linux/amd64 | ||
|
|
||
| docs: | ||
| runs-on: ubuntu-24.04 | ||
| needs: release | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '^1.24' | ||
| - name: Generate CLI docs | ||
| run: go run ./docs/gen.go | ||
| - name: Checkout replicated-docs | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: replicatedhq/replicated-docs | ||
| path: replicated-docs | ||
| token: ${{ secrets.DOCS_REPO_TOKEN }} | ||
| - name: Update docs | ||
| run: | | ||
| set -euo pipefail | ||
| VERSION=${GITHUB_REF#refs/tags/} | ||
| BRANCH_NAME="update-cli-docs-${VERSION}-$(date +%Y-%m-%d-%H%M%S)" | ||
| WORKSPACE_ROOT=$(pwd) | ||
| cd replicated-docs | ||
| git config user.name "Replicated Release Pipeline" | ||
| git config user.email "release@replicated.com" | ||
| git checkout -b "$BRANCH_NAME" | ||
| # Configure git to use token from environment variable for authentication | ||
| # This avoids exposing the token in command strings or git config history | ||
| # The credential helper reads from GITHUB_TOKEN environment variable | ||
| git config credential.helper "!f() { echo \"username=x-access-token\"; echo \"password=${GITHUB_TOKEN}\"; }; f" | ||
| git remote set-url origin https://github.com/replicatedhq/replicated-docs.git | ||
| # Remove existing CLI docs (except installing doc) | ||
| find docs/reference -name "replicated-cli-*.mdx" ! -name "replicated-cli-installing.mdx" -delete | ||
| rm -f docs/reference/replicated.mdx | ||
| # Copy new docs | ||
| for file in "${WORKSPACE_ROOT}/gen/docs"/*.md; do | ||
| if [ -f "$file" ]; then | ||
| filename=$(basename "$file" .md) | ||
| newname=$(echo "$filename" | sed 's/replicated_/replicated-cli-/g' | sed 's/_/-/g') | ||
| # Fix header level and internal links | ||
| sed 's/^## /# /' "$file" | \ | ||
| sed 's/\.md//' | \ | ||
| sed 's/replicated_/replicated-cli-/g' | \ | ||
| sed 's/_/-/g' > "docs/reference/${newname}.mdx" | ||
| fi | ||
| done | ||
| # Update sidebar - this is a simplified version, may need manual adjustment | ||
| git add . | ||
| git commit -m "Update Replicated CLI docs for ${VERSION}" | ||
| git push origin "$BRANCH_NAME" | ||
| # Create PR using GitHub CLI | ||
| gh pr create \ | ||
| --repo replicatedhq/replicated-docs \ | ||
| --base main \ | ||
| --head "$BRANCH_NAME" \ | ||
| --title "Update Replicated CLI docs for ${VERSION}" \ | ||
| --body "Automated update of CLI documentation for release ${VERSION}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Docs workflow omits sidebar updatesThe |
||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.DOCS_REPO_TOKEN }} | ||
| GH_TOKEN: ${{ secrets.DOCS_REPO_TOKEN }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,34 @@ | ||
| FROM golang:1.24 | ||
| # Build stage | ||
| FROM golang:1.24-alpine AS builder | ||
|
|
||
| ENV PROJECTPATH=/go/src/github.com/replicatedhq/replicated | ||
| WORKDIR /build | ||
|
|
||
| RUN go get github.com/go-swagger/go-swagger/cmd/swagger | ||
| # Copy go mod files | ||
| COPY go.mod go.sum ./ | ||
| RUN go mod download | ||
|
|
||
| WORKDIR $PROJECTPATH | ||
| # Copy source code | ||
| COPY . . | ||
|
|
||
| ENV GO111MODULE=on | ||
| # Build the binary | ||
| RUN CGO_ENABLED=0 go build \ | ||
| -tags "containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp" \ | ||
| -o bin/replicated \ | ||
| cli/main.go | ||
|
|
||
| CMD ["/bin/bash"] | ||
| # Final stage | ||
| FROM alpine:latest | ||
|
|
||
| RUN apk add --no-cache ca-certificates curl git && \ | ||
| update-ca-certificates | ||
|
|
||
| ENV IN_CONTAINER=1 | ||
|
|
||
| WORKDIR /out | ||
|
|
||
| # Copy binary from builder stage | ||
| COPY --from=builder /build/bin/replicated /replicated | ||
|
|
||
| LABEL com.replicated.vendor_cli=true | ||
|
|
||
| ENTRYPOINT ["/replicated"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Docker image no longer supports local spec generationThe rebuilt Additional Locations (1) |
||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.