-
Notifications
You must be signed in to change notification settings - Fork 38
117 lines (104 loc) · 3.72 KB
/
publish-repos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# 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: [deno-fresh, elixir-phoenix, php-laravel, python-flask]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./actions/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/[email protected]
if: ${{ matrix.project_id == 'prod-j3tpk' && github.ref == 'refs/heads/main' }}
with:
ssh-private-key: ${{ secrets.CODEBOT_SSH_KEY }}
- uses: ./actions/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/[email protected]
with:
ssh-private-key: ${{ secrets.CODEBOT_SSH_KEY }}
- uses: ./actions/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/[email protected]
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