name: Release on: push: tags: - 'v*' workflow_dispatch: jobs: build: runs-on: ubuntu-latest strategy: matrix: include: - goos: linux goarch: amd64 - goos: linux goarch: arm64 - goos: darwin goarch: amd64 - goos: darwin goarch: arm64 steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version-file: go.mod - name: Build env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} run: | go build \ -ldflags "-w -s -X main.version=${{ github.ref_name }}" \ -o terdut-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }} \ ./cmd/terdut - uses: actions/upload-artifact@v4 with: name: terdut-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }} path: terdut-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }} docker: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker 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: Build and push uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 push: true build-args: VERSION=${{ github.ref_name }} tags: | ghcr.io/yeniklas/terdut-server:latest ghcr.io/yeniklas/terdut-server:${{ github.ref_name }} chart: runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Configure Git run: | git config user.name "$GITHUB_ACTOR" git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: Install Helm uses: azure/setup-helm@v4 - name: Update chart versions run: | VERSION="${{ github.ref_name }}" if [[ "$VERSION" =~ ^v[0-9] ]]; then CHART_VERSION="${VERSION#v}" sed -i "s/^version:.*/version: ${CHART_VERSION}/" charts/terdut-server/Chart.yaml sed -i "s/^appVersion:.*/appVersion: \"${VERSION}\"/" charts/terdut-server/Chart.yaml fi - name: Run chart-releaser uses: helm/chart-releaser-action@v1.6.0 with: skip_existing: true env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" release: needs: build runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/download-artifact@v4 with: merge-multiple: true - uses: softprops/action-gh-release@v2 with: files: 'terdut-*'