Commit fork workflows

This commit is contained in:
Aaron Dalton 2024-01-19 07:30:40 -08:00 committed by Aaron Dalton
parent d54e1d0879
commit 79fc16bbaf
4 changed files with 75 additions and 67 deletions

View File

@ -1,31 +0,0 @@
name: Crowdin Action
on:
workflow_dispatch:
schedule:
- cron: '2 */12 * * *'
push:
paths: [
'/public/locales/en/**',
]
branches: [ main ]
jobs:
synchronize-with-crowdin:
name: Crowdin Sync
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: crowdin action
uses: crowdin/github-action@v1
with:
upload_translations: false
download_translations: true
crowdin_branch_name: main
localization_branch_name: l10n_main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

View File

@ -50,28 +50,20 @@ jobs:
build: build:
name: Docker Build & Push name: Docker Build & Push
if: github.repository == 'gethomepage/homepage' if: github.repository == 'discretizer/homepage'
runs-on: self-hosted runs-on: ubuntu-latest
needs: needs:
- pre-commit - pre-commit
permissions: permissions:
contents: read contents: read
packages: write packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@main
with:
cosign-release: 'v1.13.1' # optional
# Setup QEMU # Setup QEMU
# https://github.com/marketplace/actions/docker-setup-buildx#with-qemu # https://github.com/marketplace/actions/docker-setup-buildx#with-qemu
@ -84,13 +76,13 @@ jobs:
# This step is being disabled because the runner is on a self-hosted machine # This step is being disabled because the runner is on a self-hosted machine
# where the cache will stick between runs. # where the cache will stick between runs.
# - name: Cache Docker layers - name: Cache Docker layers
# uses: actions/cache@v3 uses: actions/cache@v3
# with: with:
# path: /tmp/.buildx-cache path: /tmp/.buildx-cache
# key: ${{ runner.os }}-buildx-${{ github.sha }} key: ${{ runner.os }}-buildx-${{ github.sha }}
# restore-keys: | restore-keys: |
# ${{ runner.os }}-buildx- ${{ runner.os }}-buildx-
# Login against a Docker registry except on PR # Login against a Docker registry except on PR
# https://github.com/docker/login-action # https://github.com/docker/login-action
@ -128,24 +120,11 @@ jobs:
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
# https://github.com/docker/setup-qemu-action#about # https://github.com/docker/setup-qemu-action#about
# platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6 # platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 platforms: linux/amd64,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
# Sign the resulting Docker image digest except on PRs. # Temp fix
# 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/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896 # https://github.com/moby/buildkit/issues/1896
- name: Move cache - name: Move cache

View File

@ -36,7 +36,7 @@ jobs:
test: test:
name: Test Build name: Test Build
if: github.repository == 'gethomepage/homepage' && github.event_name == 'pull_request' if: github.repository == 'discretizer/homepage' && github.event_name == 'pull_request'
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
- pre-commit - pre-commit
@ -59,7 +59,7 @@ jobs:
run: MKINSIDERS=false mkdocs build run: MKINSIDERS=false mkdocs build
deploy: deploy:
name: Build & Deploy name: Build & Deploy
if: github.repository == 'gethomepage/homepage' && github.event_name != 'pull_request' if: github.repository == 'discretizer/homepage' && github.event_name != 'pull_request'
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
- pre-commit - pre-commit

60
.github/workflows/fork-sync.yml vendored Normal file
View File

@ -0,0 +1,60 @@
name: Sync Fork
on:
workflow_dispatch:
inputs:
tags:
description: 'tag list'
type: string
required: false
default: ''
schedule:
- cron: '2 */12 * * *'
permissions:
contents: write
jobs:
synchronize-upstream:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git remote add upstream https://github.com/gethomepage/homepage.git
- name: Fetch Upstream Tags
id: fetch-upstream-tags
if: ${{ !inputs.tags }}
run: |
git fetch upstream --tags
fmt='
r=%(refname)
echo ${r#refs/tags/}
'
echo 'NEW_TAGS<<EOF' >> $GITHUB_OUTPUT
$(eval `git for-each-ref --format=$fmt --no-merge upstream refs/tags`) >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Set Identity
run: |
git config user.name "Github Action"
git config user.email "bot@github-actions"
- name: Create Tags
if: ${{inputs.tags || steps.fetch-upstream-tags.outputs.NEW_TAGS}}
run: |
for TAG in ${NEW_TAGS}; do
git checkout -b release/${TAG} ${TAG}
git rev-list --no-merges --reverse origin/feature/add_auth ^upstream | git cherry-pick --stdin
git rev-list --no-merges --reverse origin/fork/automation ^upstream -- .github/**| git cherry-pick --stdin
git tag -d ${TAG}
git tag ${TAG} release/${TAG}
done
for TAG in ${NEW_TAGS}; do git push -u origin release/${TAG}; done
env:
NEW_TAGS: ${{inputs.tags || steps.fetch-upstream-tags.outputs.NEW_TAGS}}
- name: Push Current
run: |
git checkout -b current upstream
git rev-list --no-merges --reverse origin/feature/add_auth ^upstream | git cherry-pick --stdin
git rev-list --no-merges --reverse origin/fork/automation ^upstream -- .github/**| git cherry-pick --stdin
git push -u origin upstream current
env:
GH_TOKEN: ${{ github.token }}