Skip to content

GHA to publish images to GCP Artifact Registry (#370) #397

GHA to publish images to GCP Artifact Registry (#370)

GHA to publish images to GCP Artifact Registry (#370) #397

Workflow file for this run

# Publish subdirectories of this monorepo to standalone repositories
name: publish-repos
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch: # We can trigger the workflow manually
push:
branches:
- main # When we merge to main
tags:
- "**" # If we added a tag (used for releases)
permissions:
contents: write
pull-requests: write
id-token: write # needed to publish images
jobs:
go-tests:
uses: ./.github/workflows/monorepo-go.yml
publish-template-images:
strategy:
matrix:
project_id: [dev-j3tpk, nonprod-j3tpk, prod-j3tpk]
template: [] # TODO: add templates

Check failure on line 30 in .github/workflows/publish-repos.yml

View workflow run for this annotation

GitHub Actions / publish-repos

Invalid workflow file

The workflow is not valid. .github/workflows/publish-repos.yml (Line: 30, Col: 19): Matrix vector 'template' does not contain any values
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./action-publish-image
if: ${{ matrix.project_id == 'dev-j3tpk' || github.ref == 'refs/heads/main' }}
env:
GITHUB_TOKEN: $${{ secrets.GITHUB_TOKEN }}
with:
gcp_project: ${{ matrix.project_id }}
template: templates/${{ matrix.template }}
- uses: webfactory/ssh-agent@v0.9.0
if: ${{ matrix.project_id == 'prod-j3tpk' && github.ref == 'refs/heads/main' }}
with:
ssh-private-key: ${{ secrets.CODEBOT_SSH_KEY }}
- uses: ./action-publish-code
if: ${{ matrix.project_id == 'prod-j3tpk' && github.ref == 'refs/heads/main' }}
with:
origin: ${{ github.repository }}
targets: >
templates/${{ matrix.template}}:jetify-examples/${{ matrix.template }}
publish-repos:
# Only publish if tests pass. Right now all tests for all repos need to pass, but as the monorepo
# gets larger, we might want to change this so that we treat each subrepo independently.
needs: go-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.CODEBOT_SSH_KEY }}
- uses: ./action-publish-code
with:
origin: ${{ github.repository }}
# TODO: consider changing this action so that instead of listing the targets, it
# automatically scans all subdirectories and looks for a config file stating where
# that subdirectory should be published. If the config file lives in the subdir,
# the monorepo can be refactored and publishing still works. As things are today,
# if you relocate a subdirectory within the monorepo, you need to update this
# yaml for things to continue to work.
targets: >
envsec
nixtest
pkg
typeid/typeid
typeid/typeid-go
typeid/typeid-sql
typeid/typeid-js
tyson
create-dependency-update-pr:
needs: publish-repos
runs-on: ubuntu-latest
steps:
- name: Sleep 20s to ensure latest repos get pulled
run: sleep 20s
- name: Checkout Monorepo
uses: actions/checkout@v4
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
enable-cache: true
- name: Mount golang cache
uses: actions/cache@v4
with:
path: |
~/.cache/golangci-lint
~/.cache/go-build
~/go/pkg
key: ${{ runner.os }}-${{ hashFiles('**/*.sum') }}
- name: Update Dependencies
run: devbox run update-internal-deps
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
title: Update Internal Dependencies
reviewers: 'loreto,mikeland73'
base: main