Skip to content

Commit f620484

Browse files
authored
Add upstream-dispatch to trigger shim (#775)
* Add upstream-dispatch to trigger shim * Switch from manual PAT to GITHUB_TOKEN
1 parent fde0bf5 commit f620484

2 files changed

Lines changed: 45 additions & 1 deletion

File tree

.github/workflows/docker-build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
with:
110110
registry: ghcr.io
111111
username: ${{ github.actor }}
112-
password: ${{ secrets.GHCR_PAT }}
112+
password: ${{ secrets.GITHUB_TOKEN }}
113113

114114
# - name: Login to Docker Hub
115115
# if: github.event_name != 'pull_request'
@@ -132,6 +132,7 @@ jobs:
132132
org.opencontainers.image.title=valheim-server
133133
org.opencontainers.image.description=Valheim Server
134134
org.opencontainers.image.licenses=Apache-2.0
135+
org.opencontainers.image.source=https://github.com/community-valheim-tools/valheim-server-docker
135136
org.opencontainers.image.documentation=https://github.com/community-valheim-tools/valheim-server-docker/blob/main/README.md
136137
137138
- name: Build and push Docker image
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Notify Legacy GHCR Shim
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
inputs:
9+
ref:
10+
description: Branch or tag ref to send to the shim repo
11+
required: false
12+
default: refs/heads/main
13+
sha:
14+
description: Exact commit SHA to build; defaults to current commit
15+
required: false
16+
17+
jobs:
18+
notify-shim:
19+
name: Trigger shim repository build
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Dispatch build to shim repository
23+
uses: actions/github-script@v8
24+
with:
25+
github-token: ${{ secrets.SHIM_REPO_DISPATCH_TOKEN }}
26+
script: |
27+
const requestedRef = context.eventName === "workflow_dispatch"
28+
? (core.getInput("ref") || "refs/heads/main")
29+
: context.ref;
30+
31+
const requestedSha = context.eventName === "workflow_dispatch"
32+
? (core.getInput("sha") || context.sha)
33+
: context.sha;
34+
35+
await github.rest.repos.createDispatchEvent({
36+
owner: "lloesche",
37+
repo: "valheim-server-docker-shim",
38+
event_type: "upstream-update",
39+
client_payload: {
40+
ref: requestedRef,
41+
sha: requestedSha
42+
}
43+
});

0 commit comments

Comments
 (0)