Skip to content

Commit 29e1e59

Browse files
committed
debug CI
1 parent 8614700 commit 29e1e59

File tree

2 files changed

+66
-31
lines changed

2 files changed

+66
-31
lines changed

.github/workflows/main.yaml

Lines changed: 62 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,60 +3,91 @@ on:
33
branches:
44
- '*'
55
jobs:
6-
build:
6+
build_website:
7+
permissions:
8+
# these permissions are needed to authenticate with gcloud
9+
contents: 'read'
10+
id-token: 'write'
11+
env:
12+
IMAGE_NAME: lichturm-website
13+
IMAGE_TAG: prod
714
runs-on: ubuntu-latest
815
steps:
916

17+
# https://github.com/actions/checkout
1018
- name: Checkout Repo
11-
uses: actions/checkout@master
19+
uses: actions/checkout@v4
1220

21+
# https://github.com/jakejarvis/hugo-build-action
1322
- name: Build Website
14-
# TODO: pick a version?
15-
uses: jakejarvis/hugo-build-action@master
23+
uses: jakejarvis/[email protected]
1624
with:
1725
args: --minify
1826

1927
# so we can inspect what is being produced
28+
# https://github.com/actions/upload-artifact
2029
- name: Upload Website as Artifact
21-
uses: actions/upload-artifact@master
30+
uses: actions/upload-artifact@v4
2231
with:
2332
name: website
2433
path: './public'
2534

35+
#https://github.com/google-github-actions/auth
2636
- name: Google Auth
2737
id: auth
2838
uses: 'google-github-actions/auth@v2'
2939
with:
3040
token_format: 'access_token'
31-
project_id: ${{ env.PROJECT_ID }}
32-
service_account: ${{ env.SERVICE_ACCOUNT }}
33-
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
41+
project_id: ${{ secrets.PROJECT_ID }}
42+
service_account: ${{ secrets.SERVICE_ACCOUNT }}
43+
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
44+
#project_id: bob
45+
#service_account: 123
46+
#workload_identity_provider: xyz
3447

48+
# https://github.com/docker/login-action
3549
- name: Docker Auth
3650
id: docker-auth
37-
uses: 'docker/login-action@v1'
51+
uses: 'docker/login-action@v3'
3852
with:
3953
username: 'oauth2accesstoken'
4054
password: '${{ steps.auth.outputs.access_token }}'
41-
registry: '${{ env.CONTAINER_REGISTRY_URL }}-docker.pkg.dev'
42-
43-
- name: Build and Push Container
44-
run: |-
45-
docker build -t "${{ env.AR_URL }}/${{ env.IMAGE_NAME }}:${{ github.sha }}" ./
46-
docker push "${{ env.AR_URL }}/${{ env.IMAGE_NAME }}:${{ github.sha }}"
47-
48-
# upload to s3
49-
- name: Install s3cmd
50-
run: |
51-
pip install s3cmd
52-
- name: Configure s3cmd
53-
run: |
54-
echo "[default]" > ~/.s3cfg
55-
echo "access_key = ${{ secrets.S3_KEY_ID }}" >> ~/.s3cfg
56-
echo "secret_key = ${{ secrets.S3_SECRET_KEY }}" >> ~/.s3cfg
57-
echo "host_base = fsn1.your-objectstorage.com" >> ~/.s3cfg
58-
echo "host_bucket = %(bucket)s.fsn1.your-objectstorage.com" >> ~/.s3cfg
59-
- name: Upload files to Hetzner S3
60-
# with this configuration, the bucket should be specified as e.g. "s3://bucket1"
61-
run: |
62-
s3cmd sync ./public ${{ secrets.S3_BUCKET }} --delete-removed
55+
registry: '${{ secrets.CONTAINER_REGISTRY_URL }}-docker.pkg.dev'
56+
57+
# https://github.com/docker/setup-qemu-action
58+
- name: Set up QEMU
59+
uses: docker/setup-qemu-action@v3
60+
61+
# https://github.com/docker/setup-buildx-action/tree/master
62+
- name: Set up Docker Buildx
63+
uses: docker/setup-buildx-action@v3
64+
with:
65+
buildkitd-flags: --debug
66+
67+
# https://github.com/docker/build-push-action
68+
- name: Build and push
69+
uses: docker/build-push-action@v6
70+
with:
71+
# we are not using the default git context because that would ignore our hugo build output
72+
# see documentation above regarding build context
73+
context: .
74+
file: ./Dockerfile
75+
push: true
76+
tags: "${{ secrets.CONTAINER_REGISTRY_URL }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}"
77+
78+
# - name: Install s3cmd
79+
# run: |
80+
# pip install s3cmd
81+
#
82+
# - name: Configure s3cmd
83+
# run: |
84+
# echo "[default]" > ~/.s3cfg
85+
# echo "access_key = ${{ secrets.S3_KEY_ID }}" >> ~/.s3cfg
86+
# echo "secret_key = ${{ secrets.S3_SECRET_KEY }}" >> ~/.s3cfg
87+
# echo "host_base = fsn1.your-objectstorage.com" >> ~/.s3cfg
88+
# echo "host_bucket = %(bucket)s.fsn1.your-objectstorage.com" >> ~/.s3cfg
89+
#
90+
# - name: Upload files to Hetzner S3
91+
# # with this configuration, the bucket should be specified as e.g. "s3://bucket1"
92+
# run: |
93+
# s3cmd sync ./public ${{ secrets.S3_BUCKET }} --delete-removed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# https://hub.docker.com/_/nginx
2+
# https://github.com/nginxinc/docker-nginx
3+
FROM nginx:1.27.3@sha256:42e917aaa1b5bb40dd0f6f7f4f857490ac7747d7ef73b391c774a41a8b994f15
4+
COPY public /usr/share/nginx/html

0 commit comments

Comments
 (0)