Skip to content

Commit

Permalink
test sync dev branch. Only build on tag
Browse files Browse the repository at this point in the history
  • Loading branch information
djeinstine committed Nov 20, 2024
1 parent b66c4ef commit 12d4f4f
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 30 deletions.
38 changes: 8 additions & 30 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ on:
# schedule:
# - cron: '20 0 * * *'
push:
branches:
- main
- feature/**
- dev
- private
# branches:
# - main
# - feature/**
# - dev
# - private
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
paths-ignore:
Expand Down Expand Up @@ -85,25 +85,16 @@ jobs:
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

# This step is being disabled because the runner is on a self-hosted machine
# where the cache will stick between runs.
# - name: Cache Docker layers
# uses: actions/cache@v3
# with:
# path: /tmp/.buildx-cache
# key: ${{ runner.os }}-buildx-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-buildx-

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
# ${{ secrets.RUNNER_TOKEN }}
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.RUNNER_TOKEN }}
password: ${{ github.token }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
Expand Down Expand Up @@ -134,20 +125,7 @@ jobs:
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
# - name: Sign the published Docker image
# if: ${{ github.event_name != 'pull_request' }}
# env:
# COSIGN_EXPERIMENTAL: "true"
# # This step uses the identity token to provision an ephemeral certificate
# # against the sigstore community Fulcio instance.
# run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}


# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/sync-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Sync djeinstine/homepage with gethomepage/homepage

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
# schedule:
# - cron: '20 0 * * *'
push:
branches:
- private

env:
REMOTE_URL: https://github.com/gethomepage/homepage.git
REPO_NAME: upstream
SYNC_BRANCH: dev

jobs:
sync-dev-branch:
runs-on: ubuntu-22.04


steps:
- name: Checkout my repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
token: ${{ github.token }}
ref: ${{env.SYNC_BRANCH}}

- name: Configure git
run: |
git remote add ${{env.REPO_NAME}} ${{env.REMOTE_URL}}
- name: Fetch remote homepage and merge
id: fetch-merge
run: |
git fetch ${{env.REPO_NAME}}
git checkout ${{env.SYNC_BRANCH}}
lines=$( git diff ${{env.SYNC_BRANCH}}..${{env.REPO_NAME}}/${{env.SYNC_BRANCH}} -- . ':(exclude).github/**' | wc -l )
echo "Number of detected line changes: $lines"
if [ $lines -gt 0 ]; then
git merge ${{env.REPO_NAME}}/${{env.SYNC_BRANCH}}
git push
fi
shell: bash

# 324 git remote add --mirror=fetch private [email protected]:lyons/homepage.git
# 325 git push private dev
# 326 git push private dev
# 327 git push private integration

0 comments on commit 12d4f4f

Please sign in to comment.