Skip to content

Commit 0c40b0e

Browse files
authored
Merge pull request #18 from unattended-backpack/dev
fix: default to Docker Hub petros; repository name from image name
2 parents 47a61e8 + 079ced2 commit 0c40b0e

6 files changed

Lines changed: 19 additions & 25 deletions

File tree

.github/scripts/create-release.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ module.exports = async ({ github, context, core }) => {
2020
const repository = process.env.GITHUB_REPOSITORY;
2121
const doRegistryName = process.env.DO_REGISTRY_NAME;
2222
const dhUsername = process.env.DH_USERNAME;
23-
const dhRepository = process.env.DH_REPOSITORY;
2423

2524
// Get digest outputs
2625
const doDigest = process.env.DO_DIGEST;
@@ -48,12 +47,12 @@ ${releaseNotes}
4847
4948
Images have been pushed to the following container registries; some may be private.
5049
${ghcrDigest ? `- GHCR: \`ghcr.io/${repository}:${sha}\`` : '- GHCR: ❌'}
51-
${dhDigest ? `- DHCR: \`${dhUsername}/${dhRepository}:${sha}\`` : '- DHCR: ❌'}
50+
${dhDigest ? `- DHCR: \`${dhUsername}/${imageName}:${sha}\`` : '- DHCR: ❌'}
5251
${doDigest ? `- DOCR: \`registry.digitalocean.com/${doRegistryName}/${imageName}:${sha}\`` : '- DOCR: ❌'}
5352
5453
\`\`\`bash
5554
docker pull ghcr.io/${repository}@${ghcrDigest}
56-
docker pull ${dhUsername}/${dhRepository}@${dhDigest}
55+
docker pull ${dhUsername}/${imageName}@${dhDigest}
5756
docker pull registry.digitalocean.com/${doRegistryName}/${imageName}@${doDigest}
5857
\`\`\`
5958

.github/scripts/rollback-registries.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# - DH_TOKEN: Docker Hub token
1414
# - DH_USERNAME: Docker Hub username
1515
# - DO_REGISTRY_NAME: DigitalOcean registry name
16-
# - DH_REPOSITORY: Docker Hub repository name
1716
# - IMAGE_NAME: Image name
1817
# - GITHUB_SHA: Git commit SHA
1918
# - GITHUB_REPOSITORY: Repository name (owner/repo)
@@ -137,7 +136,7 @@ if [ -n "$DH_DIGEST" ]; then
137136
if [ -n "$TOKEN" ]; then
138137
RESPONSE=$(curl -X DELETE \
139138
-H "Authorization: Bearer $TOKEN" \
140-
"https://hub.docker.com/v2/repositories/$DH_USERNAME/$DH_REPOSITORY/tags/$GITHUB_SHA/" \
139+
"https://hub.docker.com/v2/repositories/$DH_USERNAME/$IMAGE_NAME/tags/$GITHUB_SHA/" \
141140
-w "\n%{http_code}" -s)
142141

143142
HTTP_CODE=$(echo "$RESPONSE" | tail -n 1)

.github/scripts/sign-release-artifacts.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
# - DH_DIGEST: Docker Hub digest
1818
# - DO_REGISTRY_NAME: DigitalOcean registry name
1919
# - DH_USERNAME: Docker Hub username
20-
# - DH_REPOSITORY: Docker Hub repository name
2120

2221
set -e
2322

@@ -58,7 +57,7 @@ $DO_DIGEST
5857
5958
Registry URLs:
6059
- ghcr.io/$GITHUB_REPOSITORY@$GHCR_DIGEST
61-
- $DH_USERNAME/$DH_REPOSITORY@$DH_DIGEST
60+
- $DH_USERNAME/$IMAGE_NAME@$DH_DIGEST
6261
- registry.digitalocean.com/$DO_REGISTRY_NAME/$IMAGE_NAME@$DO_DIGEST
6362
EOF
6463

.github/workflows/release.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
id: config
2828
run: |
2929
. /opt/github-runner/secrets/registry.env
30-
BUILD_IMAGE="${BUILD_IMAGE:-petros:latest}"
30+
BUILD_IMAGE="${BUILD_IMAGE:-unattended/petros:latest}"
3131
echo "build-image=$BUILD_IMAGE" >> $GITHUB_OUTPUT
3232
echo "Using build image: $BUILD_IMAGE"
3333
@@ -116,7 +116,6 @@ jobs:
116116
# Export to environment for subsequent steps
117117
echo "DO_REGISTRY_NAME=$DO_REGISTRY_NAME" >> $GITHUB_ENV
118118
echo "DH_USERNAME=$DH_USERNAME" >> $GITHUB_ENV
119-
echo "DH_REPOSITORY=$DH_REPOSITORY" >> $GITHUB_ENV
120119
121120
- name: Generate release notes
122121
id: release-notes
@@ -221,7 +220,7 @@ jobs:
221220
id: push-dh
222221
timeout-minutes: 30
223222
run: |
224-
DH_IMAGE="${{ env.DH_USERNAME }}/${{ env.DH_REPOSITORY }}"
223+
DH_IMAGE="${{ env.DH_USERNAME }}/${{ env.IMAGE_NAME }}"
225224
docker tag "${{ env.IMAGE_NAME }}:${{ github.sha }}" \
226225
"${DH_IMAGE}:${{ github.sha }}"
227226
PUSH_OUTPUT=$(docker push "${DH_IMAGE}:${{ github.sha }}" 2>&1)
@@ -283,7 +282,7 @@ jobs:
283282
docker push "${GHCR_IMAGE}:latest"
284283
285284
# Docker Hub
286-
DH_IMAGE="${{ env.DH_USERNAME }}/${{ env.DH_REPOSITORY }}"
285+
DH_IMAGE="${{ env.DH_USERNAME }}/${{ env.IMAGE_NAME }}"
287286
docker tag "${DH_IMAGE}:${{ github.sha }}" \
288287
"${DH_IMAGE}:latest"
289288
docker push "${DH_IMAGE}:latest"
@@ -321,15 +320,19 @@ jobs:
321320
322321
- name: Perform rollback on failure
323322
id: rollback
324-
if: failure()
323+
if: >-
324+
failure() &&
325+
steps.build.outputs.build_success == 'true'
325326
env:
326327
DO_DIGEST: ${{ steps.push-do.outputs.digest }}
327328
GHCR_DIGEST: ${{ steps.push-ghcr.outputs.digest }}
328329
DH_DIGEST: ${{ steps.push-dh.outputs.digest }}
329330
run: sh .github/scripts/rollback-registries.sh
330331

331332
- name: Create rollback record
332-
if: failure()
333+
if: >-
334+
failure() &&
335+
steps.build.outputs.build_success == 'true'
333336
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd
334337
continue-on-error: true
335338
env:

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,18 @@ This file contains non-sensitive registry identifiers and build configuration:
4545

4646
```bash
4747
# The Docker image to perform release builds with.
48-
# If not set, defaults to petros:latest from Docker Hub.
48+
# If not set, defaults to unattended/petros:latest from Docker Hub.
4949
# Examples:
5050
# BUILD_IMAGE=registry.digitalocean.com/sigil/petros:latest
5151
# BUILD_IMAGE=ghcr.io/your-org/petros:latest
52-
# BUILD_IMAGE=petros:latest
53-
BUILD_IMAGE=petros:latest
52+
# BUILD_IMAGE=unattended/petros:latest
53+
BUILD_IMAGE=unattended/petros:latest
5454

5555
# The name of the DigitalOcean registry to publish the built image to.
5656
DO_REGISTRY_NAME=your-registry-name
5757

5858
# The username of the Docker Hub account to publish the built image to.
5959
DH_USERNAME=your-dockerhub-username
60-
61-
# The name of the Docker Hub repository to publish the built image to.
62-
DH_REPOSITORY=petros
6360
```
6461
### Public Configuration
6562

docs/WORKFLOW_TESTING.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,18 @@ echo "test-gpg-public-key-base64" > .act-secrets/gpg_public_key
2929

3030
cat > .act-secrets/registry.env <<'EOF'
3131
# The Docker image to perform release builds with.
32-
# If not set, defaults to petros:latest from Docker Hub
32+
# If not set, defaults to unattended/petros:latest from Docker Hub
3333
# Examples:
3434
# BUILD_IMAGE=registry.digitalocean.com/sigil/petros:latest
3535
# BUILD_IMAGE=ghcr.io/your-org/petros:latest
36-
# BUILD_IMAGE=petros:latest
37-
BUILD_IMAGE=petros:latest
36+
# BUILD_IMAGE=unattended/petros:latest
37+
BUILD_IMAGE=unattended/petros:latest
3838
3939
# The name of the DigitalOcean registry to publish the built image to.
4040
DO_REGISTRY_NAME=sigil
4141
4242
# The username of the Docker Hub account to publish the built image to.
4343
DH_USERNAME=unattended
44-
45-
# The name of the Docker Hub repository to publish the built image to.
46-
DH_REPOSITORY=petros
4744
EOF
4845

4946
chmod 700 .act-secrets

0 commit comments

Comments
 (0)