Skip to content

Commit f107499

Browse files
committed
fix: addressed review comments
1 parent 511f8ac commit f107499

File tree

2 files changed

+53
-22
lines changed

2 files changed

+53
-22
lines changed

.github/workflows/docker.yml

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,55 @@
1-
name: Docker Push
1+
name: Publish docker image
2+
23
on:
3-
push:
4-
tags: ['v*']
4+
workflow_dispatch:
5+
inputs:
6+
release_tag:
7+
description: 'Tag to release'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: read
13+
packages: write
14+
515
jobs:
6-
build:
7-
runs-on: ubuntu-latest
8-
environment: main
9-
steps:
10-
- name: Check out code
11-
uses: actions/checkout@v4
12-
- name: Log in to Docker Hub
13-
run: echo $DOCKER_TOKEN | docker login --username=anishathalye --password-stdin
14-
env:
15-
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
16-
- name: Compute tag
17-
id: tag
18-
run: echo ::set-output name=TAG ::anishathalye/proof-html:${GITHUB_REF#refs/tags/v}
19-
- name: Build image
20-
run: docker build . -t ${{ steps.tag.outputs.TAG }}
21-
- name: Publish image
22-
run: docker push ${{ steps.tag.outputs.TAG }}
16+
build:
17+
runs-on: ubuntu-latest
18+
if: startsWith(github.event.inputs.release_tag, 'v')
19+
steps:
20+
- name: Harden the runner (Audit all outbound calls)
21+
uses: step-security/harden-runner@v2
22+
with:
23+
egress-policy: audit
24+
25+
- name: Checkout
26+
uses: actions/checkout@v5
27+
- name: Validate tag format
28+
run: |
29+
TAG=${{ github.event.inputs.release_tag }}
30+
if ! echo "$TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
31+
echo "❌ Invalid tag format: $TAG"
32+
exit 1
33+
fi
34+
echo "✅ Valid semver tag: $TAG"
35+
- name: Log in to GitHub Container Registry
36+
uses: docker/login-action@v3
37+
with:
38+
registry: ghcr.io
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Set up QEMU for ARM builds
43+
uses: docker/setup-qemu-action@v3
44+
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
47+
48+
- name: Build and push Docker image
49+
uses: docker/build-push-action@v6
50+
with:
51+
context: .
52+
push: true
53+
platforms: linux/amd64,linux/arm64
54+
tags: |
55+
ghcr.io/${{ github.repository }}:${{ github.event.inputs.release_tag }}

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ jobs:
141141
https://en.wikipedia.org/wiki/Main_Page
142142
ignore_url_re: |
143143
^https://twitter.com/
144-
swap_urls: |
145-
{"^https://www.anishathalye.com/": "/"}
146144
```
147145

148146
## Running locally

0 commit comments

Comments
 (0)