Skip to content

Commit b91e3a8

Browse files
authored
ci: Fix the workflow for publishing release images to Docker Hub (#3650)
1 parent 464c9b4 commit b91e3a8

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

.github/workflows/changesets_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
publish: pnpm ci:publish
4444
title: 'chore: publish new package versions'
4545
env:
46-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
GITHUB_TOKEN: ${{ secrets.OLEKSII_PAT_TOKEN_FOR_DOCKERHUB_RELEASE_WORKFLOW }}
4747
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
4848
- name: Add latest tag to published packages
4949
if: steps.changesets.outputs.published == 'true'

.github/workflows/sync_service_dockerhub_image.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ on:
44
push:
55
branches: ['main']
66
release:
7-
released:
7+
types: [released]
8+
workflow_dispatch:
9+
inputs:
10+
release_tag:
11+
description: 'The @core/sync-service@... tag to run for (e.g. @core/sync-service@v1.2.10)'
12+
required: true
13+
type: string
814

915
jobs:
1016
derive_build_vars:
@@ -17,11 +23,20 @@ jobs:
1723
steps:
1824
- uses: actions/checkout@v4
1925
with:
20-
# It is crucial that we checkout the actual HEAD commit of the branch instead of
21-
# GitHub's ephemeral merge commit that it creates for CI runs by default.
22-
# We rely on the correct HEAD commit to be checked out in order to determine the
23-
# correct ELECTRIC_VERSION to bake into the Docker image.
24-
ref: ${{ github.event.pull_request.head.sha }}
26+
# The checked out commit influences the value of the ELECTRIC_VERSION variable
27+
# that is baked into the Docker image.
28+
#
29+
# For regular pushes to main, we check out the HEAD commit and publish canary images.
30+
#
31+
# For releases we check out the tag corresponding to the release, e.g.
32+
# @core/sync-service@v1.2.10.
33+
#
34+
# For manual triggers via workflow_dispatch, we check out the tag specified manually
35+
# by the actor.
36+
ref: ${{
37+
github.event_name == 'release' && format('refs/tags/{0}', github.event.release.tag_name) ||
38+
github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.release_tag) ||
39+
github.sha }}
2540
# Also important to fetch the whole history since otherwise we won't get that tags
2641
# that are required to determine the correct ELECTRIC_VERSION.
2742
fetch-depth: 0

0 commit comments

Comments
 (0)