build(deps-dev): bump @types/node from 24.7.2 to 24.9.2 in /web #37
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: CI | |
| on: | |
| push: | |
| branches: [master, main] | |
| tags: ['*'] | |
| pull_request: | |
| branches: [master, main] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| GOTOOLCHAIN: auto | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25' | |
| check-latest: true | |
| cache: true | |
| - name: Check formatting | |
| run: | | |
| fmt_out=$(gofmt -l ./cmd ./internal 2>/dev/null) | |
| if [ -n "$fmt_out" ]; then | |
| echo "The following files need gofmt:" | |
| echo "$fmt_out" | |
| exit 1 | |
| fi | |
| - name: Static analysis | |
| run: go vet ./... | |
| - name: Go tests | |
| run: go test ./... | |
| - name: Go tests (race) | |
| run: go test -race -ldflags "-linkmode=external" ./... | |
| - name: Build backend binary | |
| run: go build ./cmd/amdgputop-web | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: web/package-lock.json | |
| - name: Install frontend dependencies | |
| run: npm ci | |
| working-directory: web | |
| - name: Build frontend bundle | |
| run: npm run build | |
| working-directory: web | |
| release: | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| env: | |
| GOTOOLCHAIN: auto | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25' | |
| check-latest: true | |
| cache: true | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: web/package-lock.json | |
| - name: Install frontend dependencies | |
| run: npm ci | |
| working-directory: web | |
| - name: Build frontend bundle | |
| run: npm run build | |
| working-directory: web | |
| - name: Collect version metadata | |
| id: vars | |
| run: | | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| COMMIT="$(git rev-parse --short HEAD)" | |
| BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "commit=$COMMIT" >> "$GITHUB_OUTPUT" | |
| echo "build_time=$BUILD_TIME" >> "$GITHUB_OUTPUT" | |
| - name: Generate changelog | |
| id: changelog | |
| env: | |
| CURRENT_TAG: ${{ steps.vars.outputs.version }} | |
| run: | | |
| CURRENT_COMMIT="$(git rev-list -n 1 "$CURRENT_TAG")" | |
| PREVIOUS_TAG="" | |
| if git rev-parse "${CURRENT_COMMIT}^" >/dev/null 2>&1; then | |
| PREVIOUS_TAG="$(git describe --tags --abbrev=0 "${CURRENT_COMMIT}^" 2>/dev/null || true)" | |
| fi | |
| if [ -n "$PREVIOUS_TAG" ]; then | |
| CHANGELOG="$(git log --no-merges --pretty=format:'- %s (%h)' "${PREVIOUS_TAG}..${CURRENT_TAG}")" | |
| if [ -z "$CHANGELOG" ]; then | |
| CHANGELOG="- No changes since ${PREVIOUS_TAG}." | |
| fi | |
| { | |
| echo "body<<EOF" | |
| echo "## Changes" | |
| printf '\n' | |
| printf '%s\n' "$CHANGELOG" | |
| printf '\n' | |
| echo "[Compare ${PREVIOUS_TAG}...${CURRENT_TAG}](https://github.com/${GITHUB_REPOSITORY}/compare/${PREVIOUS_TAG}...${CURRENT_TAG})" | |
| echo "EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| else | |
| { | |
| echo "body<<EOF" | |
| echo "## Changes" | |
| printf '\n' | |
| echo "- Initial release." | |
| echo "EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Build release binary | |
| run: | | |
| mkdir -p dist | |
| GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -trimpath \ | |
| -ldflags "-s -w -X main.buildVersion=${{ steps.vars.outputs.version }} -X main.buildCommit=${{ steps.vars.outputs.commit }} -X main.buildTime=${{ steps.vars.outputs.build_time }}" \ | |
| -o dist/amdgputop-web ./cmd/amdgputop-web | |
| tar -C dist -czf "amdgputop-web_${{ steps.vars.outputs.version }}_linux_amd64.tar.gz" amdgputop-web | |
| - name: Upload release binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: amdgputop-web-linux-amd64 | |
| path: amdgputop-web_${{ steps.vars.outputs.version }}_linux_amd64.tar.gz | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.version }} | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
| build-args: | | |
| VERSION=${{ steps.vars.outputs.version }} | |
| COMMIT=${{ steps.vars.outputs.commit }} | |
| BUILD_TIME=${{ steps.vars.outputs.build_time }} | |
| - name: Publish GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: amdgputop-web_${{ steps.vars.outputs.version }}_linux_amd64.tar.gz | |
| body: ${{ steps.changelog.outputs.body }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |