Skip to content

fix: set user to authenticate #82

fix: set user to authenticate

fix: set user to authenticate #82

Workflow file for this run

name: Deploy Release
on:
push:
branches:
- 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
env:
CI: true
jobs:
build:
runs-on: ubuntu-latest
environment: development
strategy:
matrix:
go-version: [ '1.22' ]
node-version: [ 18 ]
goarch: [ 'amd64', 'arm64' ] # Define architectures here
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
working-directory: frontend
run: npm ci
- name: Build
working-directory: frontend
run: npm run build
- name: Install ARM64 cross-compiler
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Install dependencies
working-directory: backend
run: go get ./...
- name: Set up CC for cross-compilation
if: matrix.goarch == 'arm64'
run: echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Build
working-directory: backend
run: |
GOOS=linux GOARCH=${{ matrix.goarch }} CGO_ENABLED=1 go build -o build/kubevoyage-${{ matrix.goarch }} ./cmd/kubevoyage
#- name: Test with the Go CLI
# run: go test
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: production-artifacts
path: |
backend/
frontend/public
build-docker:
needs: build
runs-on: ubuntu-latest
if: ${{ github.ref }} != 'master' && ${{ github.ref }} != 'development'
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: production-artifacts
- name: Set up Docker Build
uses: docker/setup-buildx-action@v3
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/kubevoyage:${{ env.BRANCH_NAME }}
platforms: linux/amd64,linux/arm64
helm-release:
needs: build-docker
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: deploy/charts
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
registryImage: ${{ secrets.DOCKERHUB_USERNAME }}/kubevoyage
imageTag: ${{ github.head_ref || github.ref_name }}
CR_TOKEN: ${{ secrets.PAT }}