Skip to content

Remove explicit Go cache handling. #159

Remove explicit Go cache handling.

Remove explicit Go cache handling. #159

Workflow file for this run

name: CI
on:
push:
release:
types: [published]
workflow_dispatch:
inputs:
upload:
description: 'Upload the docker container'
required: false
default: false
type: boolean
env:
DOCKER_NAME: tpkg_registry
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # Fetch the whole history.
# Use Go 1.17
- name: Switch to Go 1.17
uses: actions/setup-go@v5
with:
go-version: '^1.17.0'
- name: Go dependencies
run: |
make go_dependencies
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install protobuf-compiler
- name: Build protobuf
run: |
make protobuf
- name: Build binary
run: |
make registry
- name: Test
run: |
make test
- name: Fetch dependencies
run: |
make image-dependencies
- name: Print known-hosts
run: |
ssh-keyscan github.com >> known_hosts
echo "You can use the following known_hosts file to add to your secrets"
cat known_hosts
- name: Build build-args
run: |
echo "BUILD_ARGS=$(make docker-build-args)" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/${{ env.DOCKER_NAME }}
# Generate Docker tags based on the following events/attributes.
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Print configuration
run: |
echo "DOCKER_NAME=${{ env.DOCKER_NAME }}"
echo "BUILD_ARGS=${{ env.BUILD_ARGS }}"
echo "TAGS=${{ steps.meta.outputs.tags }}"
echo "LABELS=${{ steps.meta.outputs.labels }}"
- name: Login to GHCR
if: |
github.event.inputs.upload == 'true' ||
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
github.event_name == 'release'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: ${{
github.event.inputs.upload == 'true' ||
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
github.event_name == 'release' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
context: .
build-args: |
${{ env.BUILD_ARGS }}