mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-28 17:54:41 +01:00
b20b16ad6e
* Try a different fix * Test on PR * Fix commit SHA * Hard-code commit ref * Update `EndBug/add-and-commit` * Don't run on PRs This was just for testing. * Use v3 of PostHog/git-sync
53 lines
2.4 KiB
YAML
53 lines
2.4 KiB
YAML
name: Sync PostHog FOSS
|
||
|
||
on:
|
||
push:
|
||
branches:
|
||
- master
|
||
- main
|
||
|
||
jobs:
|
||
repo-sync:
|
||
name: Sync posthog-foss with posthog
|
||
if: github.repository == 'PostHog/posthog'
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Sync repositories 1 to 1 - master branch
|
||
uses: PostHog/git-sync@v3
|
||
with:
|
||
source_repo: 'https://posthog-bot:${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}@github.com/posthog/posthog.git'
|
||
source_branch: 'master'
|
||
destination_repo: 'https://posthog-bot:${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}@github.com/posthog/posthog-foss.git'
|
||
destination_branch: 'master'
|
||
- name: Sync repositories 1 to 1 – tags
|
||
uses: PostHog/git-sync@v3
|
||
with:
|
||
source_repo: 'https://posthog-bot:${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}@github.com/posthog/posthog.git'
|
||
source_branch: 'refs/tags/*'
|
||
destination_repo: 'https://posthog-bot:${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}@github.com/posthog/posthog-foss.git'
|
||
destination_branch: 'refs/tags/*'
|
||
- name: Checkout posthog-foss
|
||
uses: actions/checkout@v3
|
||
with:
|
||
repository: 'posthog/posthog-foss'
|
||
ref: master
|
||
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
|
||
- name: Change LICENSE to pure MIT
|
||
run: |
|
||
sed -i -e '/PostHog Inc\./,/Permission is hereby granted/c\Copyright (c) 2020-2021 PostHog Inc\.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy' LICENSE
|
||
echo -e "MIT License\n\n$(cat LICENSE)" > LICENSE
|
||
- name: Remove unused GitHub workflows
|
||
run: |
|
||
cd .github/workflows
|
||
ls | grep -v foss-release-image-publish.yml | xargs rm
|
||
|
||
- name: Commit "Sync and remove all non-FOSS parts"
|
||
uses: EndBug/add-and-commit@v9
|
||
with:
|
||
message: 'Sync and remove all non-FOSS parts'
|
||
remove: '["-r ee/"]'
|
||
default_author: github_actions
|
||
github_token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
|
||
repository: 'posthog/posthog-foss'
|
||
ref: master
|