Skip to content

feat(): nixos flake #245

feat(): nixos flake

feat(): nixos flake #245

Workflow file for this run

name: build
on:
pull_request:
# For the develop branch only.
branches:
- main
# Execute the action on closed (merged) PR.
types: [closed]
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-20.04
permissions:
contents: "read"
id-token: "write"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
id: meta
with:
images: Build
- name: Short SHA for Tags
id: short
run: |
calculated=$(git rev-parse --short ${{ github.sha }})
echo "short_sha=$calculated" >> $GITHUB_OUTPUT
- name: GCP Auth
id: auth
uses: "google-github-actions/auth@v2"
with:
token_format: access_token
credentials_json: ${{ secrets.GCP_JSON_KEY }}
access_token_lifetime: 600s
- name: GCP Artifact Registry Auth
id: auth-gcp-artifact-registry
uses: docker/login-action@v3
with:
registry: ${{ vars.GCP_ARTIFACT_REPOSITORY }}
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: GCP Kubernetes Engine Auth
uses: google-github-actions/get-gke-credentials@v2
with:
cluster_name: ${{ vars.GKE_CLUSTER }}
location: ${{ vars.GKE_CLUSTER_ZONE }}
- name: Docker Buildx Cache
id: go-cache
uses: actions/cache@v4
with:
path: |
go-mod-cache
go-build-cache
key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }}
- name: Docker Buildx Cache Dance
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"go-mod-cache": "/root/go/pkg/mod",
"go-build-cache": "/root/.cache/go-build"
}
skip-extraction: ${{ steps.go-cache.outputs.cache-hit }}
- name: Build/Push - API
id: build-api
uses: docker/build-push-action@v5
with:
context: .
target: api
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: |
${{ vars.GCP_ARTIFACT_REPOSITORY }}/api:latest
${{ vars.GCP_ARTIFACT_REPOSITORY }}/api:${{ steps.short.outputs.short_sha }}
- name: Build/Push - Mothership
id: build-mothership
uses: docker/build-push-action@v5
with:
context: .
target: mothership
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: |
${{ vars.GCP_ARTIFACT_REPOSITORY }}/mothership:latest
${{ vars.GCP_ARTIFACT_REPOSITORY }}/mothership:${{ steps.short.outputs.short_sha }}
- name: Build/Push - Migrate
id: build-migrate
uses: docker/build-push-action@v5
with:
context: .
target: migrate
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: |
${{ vars.GCP_ARTIFACT_REPOSITORY }}/migrate:latest
${{ vars.GCP_ARTIFACT_REPOSITORY }}/migrate:${{ steps.short.outputs.short_sha }}