Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/npm-audit-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ jobs:
if: steps.checkout.outcome == 'success'
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
with:
client-id: ${{ vars.LIBRECODE_WORKFLOW_APP_CLIENT_ID }}
private-key: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }}
client-id: ${{ vars.WORKFLOW_SYNC_APP_CLIENT_ID }}
private-key: ${{ secrets.WORKFLOW_SYNC_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: ${{ github.event.repository.name }}
permission-contents: write
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
config-path: .nextcloud-release.yml
actor: ${{ github.actor }}
github-token: ${{ secrets.GITHUB_TOKEN }}
app-private-key: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }}
app-private-key: ${{ secrets.WORKFLOW_SYNC_APP_PRIVATE_KEY }}
pipeline-reference-ref: refs/remotes/origin/main

post_merge:
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
config-path: .nextcloud-release.yml
prepare-workflow-path: .github/workflows/prepare-release.yml
github-token: ${{ secrets.GITHUB_TOKEN }}
app-private-key: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }}
app-private-key: ${{ secrets.WORKFLOW_SYNC_APP_PRIVATE_KEY }}

verify_publication:
name: Verify published release
Expand Down
44 changes: 11 additions & 33 deletions .github/workflows/sync-workflow-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
contents: write
pull-requests: write

env:
AUTH_MODE: ${{ vars.WORKFLOW_SYNC_AUTH_MODE || 'github-app' }}

steps:
- name: Check actor permission
if: ${{ github.event_name == 'workflow_dispatch' }}
Expand All @@ -56,24 +59,15 @@ jobs:
- name: Validate workflow sync authentication
shell: bash
env:
AUTH_MODE: ${{ vars.WORKFLOW_SYNC_AUTH_MODE || 'librecode-app' }}
LIBRECODE_APP_CLIENT_ID: ${{ vars.LIBRECODE_WORKFLOW_APP_CLIENT_ID }}
LIBRECODE_APP_PRIVATE_KEY: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }}
CONSUMER_APP_CLIENT_ID: ${{ vars.WORKFLOW_SYNC_APP_CLIENT_ID }}
CONSUMER_APP_PRIVATE_KEY: ${{ secrets.WORKFLOW_SYNC_APP_PRIVATE_KEY }}
APP_CLIENT_ID: ${{ vars.WORKFLOW_SYNC_APP_CLIENT_ID }}
APP_PRIVATE_KEY: ${{ secrets.WORKFLOW_SYNC_APP_PRIVATE_KEY }}
CONSUMER_TOKEN: ${{ secrets.WORKFLOW_SYNC_TOKEN }}
run: |
set -euo pipefail

case "${AUTH_MODE}" in
librecode-app)
[[ -n "${LIBRECODE_APP_CLIENT_ID}" && -n "${LIBRECODE_APP_PRIVATE_KEY}" ]] || {
echo "::error::librecode-app requires LIBRECODE_WORKFLOW_APP_CLIENT_ID and LIBRECODE_WORKFLOW_APP_PRIVATE_KEY"
exit 1
}
;;
github-app)
[[ -n "${CONSUMER_APP_CLIENT_ID}" && -n "${CONSUMER_APP_PRIVATE_KEY}" ]] || {
[[ -n "${APP_CLIENT_ID}" && -n "${APP_PRIVATE_KEY}" ]] || {
echo "::error::github-app requires WORKFLOW_SYNC_APP_CLIENT_ID and WORKFLOW_SYNC_APP_PRIVATE_KEY"
exit 1
}
Expand All @@ -92,22 +86,9 @@ jobs:
;;
esac

- name: Create LibreCode GitHub App token
if: ${{ vars.WORKFLOW_SYNC_AUTH_MODE == '' || vars.WORKFLOW_SYNC_AUTH_MODE == 'librecode-app' }}
id: librecode-app-token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
with:
client-id: ${{ vars.LIBRECODE_WORKFLOW_APP_CLIENT_ID }}
private-key: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: ${{ github.event.repository.name }}
permission-contents: write
permission-pull-requests: write
permission-workflows: write

- name: Create consumer GitHub App token
if: ${{ vars.WORKFLOW_SYNC_AUTH_MODE == 'github-app' }}
id: consumer-app-token
- name: Create GitHub App token
if: ${{ env.AUTH_MODE == 'github-app' }}
id: workflow-app-token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
with:
client-id: ${{ vars.WORKFLOW_SYNC_APP_CLIENT_ID }}
Expand All @@ -122,17 +103,14 @@ jobs:
id: auth-token
shell: bash
env:
AUTH_MODE: ${{ vars.WORKFLOW_SYNC_AUTH_MODE || 'librecode-app' }}
LIBRECODE_APP_TOKEN: ${{ steps.librecode-app-token.outputs.token }}
CONSUMER_APP_TOKEN: ${{ steps.consumer-app-token.outputs.token }}
WORKFLOW_APP_TOKEN: ${{ steps.workflow-app-token.outputs.token }}
CONSUMER_TOKEN: ${{ secrets.WORKFLOW_SYNC_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail

case "${AUTH_MODE}" in
librecode-app) token="${LIBRECODE_APP_TOKEN}" ;;
github-app) token="${CONSUMER_APP_TOKEN}" ;;
github-app) token="${WORKFLOW_APP_TOKEN}" ;;
token) token="${CONSUMER_TOKEN}" ;;
github-token) token="${GITHUB_TOKEN}" ;;
*) exit 1 ;;
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/sync-workflow-templates.yml.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
--- a/.github/workflows/sync-workflow-templates.yml
+++ b/.github/workflows/sync-workflow-templates.yml
@@ -27,6 +27,9 @@ jobs:
@@ -28,7 +28,10 @@
fail-fast: false
matrix:
branches:
- ${{ github.event.repository.default_branch }}
Expand All @@ -9,3 +10,4 @@
+ - stable33

name: Update workflows in ${{ matrix.branches }}

Loading