Skip to content

chore: upgrade to agent api v2 (#27) #16

chore: upgrade to agent api v2 (#27)

chore: upgrade to agent api v2 (#27) #16

Workflow file for this run

name: release
on:
push:
tags:
- "v*"
permissions:
# Required to publish a release
contents: write
# Necessary to push docker images to ghcr.io.
packages: write
# Necessary for GCP authentication (https://github.com/google-github-actions/setup-gcloud#usage)
id-token: write
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Build and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Echo Go Cache Paths
id: go-cache-paths
run: |
echo "GOCACHE=$(go env GOCACHE)" >> ${{ runner.os == 'Windows' && '$env:' || '$' }}GITHUB_OUTPUT
echo "GOMODCACHE=$(go env GOMODCACHE)" >> ${{ runner.os == 'Windows' && '$env:' || '$' }}GITHUB_OUTPUT
- name: Go Build Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.GOCACHE }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.**', '**.go') }}
- uses: actions/setup-go@v3
with:
go-version: "~1.22"
- name: Get Version
run: echo "version=$(./scripts/version.sh)" >> $GITHUB_OUTPUT
id: version
- name: Build
run: ./scripts/build.sh
- name: Docker Login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Image
run: |
VERSION=$(./scripts/version.sh)
BASE=ghcr.io/coder/coder-logstream-kube
IMAGE=$BASE:$VERSION
docker tag coder-logstream-kube:latest $IMAGE
docker tag coder-logstream-kube:latest $BASE:latest
docker push $IMAGE
docker push $BASE:latest
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_ID_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- name: Setup GCloud SDK
uses: "google-github-actions/setup-gcloud@v1"
- name: Publish Helm Chart
run: |
set -euo pipefail
version="$(./scripts/version.sh)"
./scripts/helm.sh --version $version
mkdir -p build/helm
cp "build/${version}.tgz" build/helm
gsutil cp gs://helm.coder.com/logstream-kube/index.yaml build/helm/index.yaml
helm repo index build/helm --url https://helm.coder.com/logstream-kube --merge build/helm/index.yaml
gsutil -h "Cache-Control:no-cache,max-age=0" cp build/helm/${version}.tgz gs://helm.coder.com/logstream-kube
gsutil -h "Cache-Control:no-cache,max-age=0" cp build/helm/index.yaml gs://helm.coder.com/logstream-kube
- name: Create Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ github.token }}
with:
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ github.ref }}
- name: Upload Helm Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/${{ steps.version.outputs.version }}.tgz
asset_name: helm.tar.gz
asset_content_type: application/gzip