Skip to content

Commit

Permalink
feat: initial setup
Browse files Browse the repository at this point in the history
Signed-off-by: Brooks Townsend <[email protected]>
  • Loading branch information
brooksmtownsend committed Dec 20, 2023
1 parent 0b0d886 commit f41d16f
Show file tree
Hide file tree
Showing 94 changed files with 454 additions and 2,456 deletions.
12 changes: 12 additions & 0 deletions .github/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# Remove the init workflow so it won't get run more than once
git rm .github/workflows/init.yml

# Update links in the README
UPSTREAM_REPOSITORY="github.com/${TEMPLATE_REPOSITORY}/compare"
CURRENT_REPOSITORY="github.com/${GITHUB_REPOSITORY}/compare"
sed -i "s|${UPSTREAM_REPOSITORY}|${CURRENT_REPOSITORY}|g" README.md

# Update the Argo CD Application definition to point to this repository
sed -i "s|${TEMPLATE_REPOSITORY}|${GITHUB_REPOSITORY}|g" setup/argocd-application.yaml
74 changes: 74 additions & 0 deletions .github/workflows/init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Initialize the repository

on:
push:
branches:
- main

env:
TEMPLATE_REPOSITORY: cosmonic/concordance-gitops

jobs:
init:
# Don't run this in the template repository.
if: ${{ github.repository != 'cosmonic/concordance-gitops' }}
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "main"

- name: Setup GitHub Actions as the commiter
run: |
git config --local user.name 'github-actions[bot]'
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
# Remove this workflow so it won't run again.
- name: Clean up main
run: |
./.github/init.sh
git add -A
git commit -m "Initialize the repository"
- name: Ensure release branches exist
run: |
release_branches=$(git branch -r | awk '/release/ { gsub(/origin\//, "", $1); print $1 }')
if [ -z "${release_branches}" ]; then
git remote add upstream "https://github.com/${TEMPLATE_REPOSITORY}"
git fetch upstream
upstream_branches=$(git branch -r | awk '/release/ { gsub(/upstream\//, "", $1); print $1 }')
for branch_name in $upstream_branches
do
git checkout --orphan "${branch_name}" "upstream/${branch_name}"
git init .
git commit --message "Initialize ${upstream_branch}"
done
git push --branches
git remote remove upstream
fi
- name: Setup each release branch for pull requests
run: |
release_branches=$(git branch -r | awk '/release/ { gsub(/origin\//, "", $1); print $1 }')
if [ -z "${release_branches}" ]; then
echo "No release branches."
exit 1
fi
rebase_from='main'
for branch_name in $release_branches
do
git checkout "${branch_name}"
git rebase -X theirs "${rebase_from}"
./.github/init.sh
git add -A
git commit --amend --no-edit
rebase_from=$branch_name
done
git checkout main
git push --all -f
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ host_config.json

# rebar lock file
rebar.lock

# wasm files
*.wasm
File renamed without changes.
16 changes: 16 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set shell := ["bash", "-cu"]

build:
# Ensure events are up-to-date
cd eventcatalog && npm run build
# Build all the actors using `wash build`
for dir in $(find . -type f -name 'Cargo.toml' | xargs -n1 dirname | rg -v node_modules); do \
echo "Building $dir"; \
export WASH_ISSUER_KEY=$(pwd)/.keys/bank_issuer.nk; \
(cd $dir && wash build); \
done

version := "0.0.0"
push:
# Push to GHCR
wash push ghcr.io/cosmonic/cosmonic-gitops/bankaccount_catalog:{{version}} eventcatalog/actor/build/bankaccountcatalog_s.wasm
Loading

0 comments on commit f41d16f

Please sign in to comment.