Skip to content

Commit d932aa3

Browse files
authored
Merge pull request #922 from openwallet-foundation/chore/fix-release-workflow
Fix release workflow
2 parents 756ad51 + 66da766 commit d932aa3

File tree

4 files changed

+94
-12
lines changed

4 files changed

+94
-12
lines changed

.github/workflows/on_push_main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_dispatch:
44
inputs:
55
ref:
6-
description: 'Branch or full SHA to deploy'
6+
description: 'Branch or full SHA to build'
77
required: false
88
default: 'main'
99
push:

.github/workflows/publish.yml

Lines changed: 82 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,90 @@ jobs:
4949
image_tag: ${{ steps.values.outputs.image_tag }}
5050
image_version: ${{ steps.values.outputs.image_version }}
5151
steps:
52+
- name: Determine checkout ref
53+
id: ref
54+
run: |
55+
if [ -n "${{ inputs.ref }}" ]; then
56+
echo "checkout_ref=${{ inputs.ref }}" >> $GITHUB_OUTPUT
57+
echo "Building from specified ref: ${{ inputs.ref }}"
58+
elif [ -n "${{ github.event.release.tag_name }}" ]; then
59+
echo "checkout_ref=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
60+
echo "Building from release tag: ${{ github.event.release.tag_name }}"
61+
else
62+
echo "checkout_ref=${{ github.ref }}" >> $GITHUB_OUTPUT
63+
echo "Building from triggering ref: ${{ github.ref }}"
64+
fi
65+
5266
- name: Checkout Code
5367
uses: actions/checkout@v5
5468
with:
55-
ref: ${{ inputs.ref || '' }}
69+
ref: ${{ steps.ref.outputs.checkout_ref }}
70+
71+
- name: Verify checkout
72+
run: |
73+
echo "Checked out ref: $(git describe --always --tags)"
74+
echo "Current commit: $(git rev-parse HEAD)"
75+
echo "Current branch/tag: $(git branch --show-current || git describe --tags --exact-match 2>/dev/null || echo 'detached HEAD')"
76+
77+
# If a specific ref was requested, verify we're on it
78+
if [ -n "${{ inputs.ref }}" ]; then
79+
REQUESTED_REF="${{ inputs.ref }}"
80+
CURRENT_REF=$(git rev-parse HEAD)
81+
REQUESTED_SHA=$(git rev-parse "$REQUESTED_REF" 2>/dev/null || echo "unknown")
82+
83+
if [ "$CURRENT_REF" != "$REQUESTED_SHA" ]; then
84+
echo "ERROR: Failed to checkout requested ref '$REQUESTED_REF'"
85+
echo "Expected SHA: $REQUESTED_SHA"
86+
echo "Current SHA: $CURRENT_REF"
87+
exit 1
88+
fi
89+
echo "✓ Successfully verified checkout of ref: $REQUESTED_REF"
90+
fi
5691
5792
- name: Gather image info
5893
id: info
5994
run: |
6095
echo "repo-owner=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_OUTPUT
96+
97+
# Determine tags based on what we checked out
98+
CHECKOUT_REF="${{ steps.ref.outputs.checkout_ref }}"
99+
echo "Determining tags for ref: ${CHECKOUT_REF}"
100+
101+
TAGS="ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/acapy-vc-authn-oidc:"
102+
103+
# Check if it's a semver tag (v1.2.3 or 1.2.3)
104+
if [[ "${CHECKOUT_REF}" =~ ^refs/tags/v?([0-9]+\.[0-9]+\.[0-9]+.*)$ ]] || [[ "${CHECKOUT_REF}" =~ ^v?([0-9]+\.[0-9]+\.[0-9]+.*)$ ]]; then
105+
VERSION="${BASH_REMATCH[1]}"
106+
echo "Detected version: ${VERSION}"
107+
108+
# Full version tag
109+
TAGS="${TAGS}${VERSION}"
110+
111+
# Major.minor tag
112+
if [[ "${VERSION}" =~ ^([0-9]+\.[0-9]+) ]]; then
113+
TAGS="${TAGS},ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/acapy-vc-authn-oidc:${BASH_REMATCH[1]}"
114+
fi
115+
116+
# Latest tag for releases
117+
TAGS="${TAGS},ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/acapy-vc-authn-oidc:latest"
118+
119+
# Check if it's main branch
120+
elif [[ "${CHECKOUT_REF}" == "refs/heads/main" ]] || [[ "${CHECKOUT_REF}" == "main" ]]; then
121+
echo "Building from main branch"
122+
TAGS="${TAGS}dev"
123+
124+
# For other branches, use branch name
125+
else
126+
# Extract branch name from refs/heads/branch-name or just use as-is
127+
BRANCH_NAME="${CHECKOUT_REF#refs/heads/}"
128+
# Sanitize branch name for docker tag (replace / with -)
129+
BRANCH_NAME="${BRANCH_NAME//\//-}"
130+
echo "Building from branch: ${BRANCH_NAME}"
131+
TAGS="${TAGS}${BRANCH_NAME}"
132+
fi
133+
134+
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
135+
echo "Generated tags: ${TAGS}"
61136
62137
- name: Cache Docker layers
63138
uses: actions/cache@v4
@@ -83,22 +158,20 @@ jobs:
83158
with:
84159
images: |
85160
ghcr.io/${{ steps.info.outputs.repo-owner }}/acapy-vc-authn-oidc
161+
# We generate tags manually in the "Gather image info" step
162+
# but still use metadata-action for labels
86163
tags: |
87-
type=semver,pattern={{version}}
88-
type=semver,pattern={{major}}.{{minor}}
89-
# set dev tag when building from the default branch (main)
90-
type=raw,value=dev,enable={{is_default_branch}}
91-
# set latest tag for published release
92-
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
93-
164+
type=raw,value=dummy
165+
flavor: |
166+
latest=false
94167
95168
- name: Build and Push Image to ghcr.io
96169
uses: docker/build-push-action@v6
97170
with:
98171
push: true
99172
context: .
100173
file: docker/oidc-controller/Dockerfile
101-
tags: ${{ steps.meta.outputs.tags }}
174+
tags: ${{ steps.info.outputs.tags }}
102175
labels: ${{ steps.meta.outputs.labels }}
103176
target: main
104177
cache-from: type=local,src=/tmp/.buildx-cache

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ curl -X 'POST' \
7474
"names": ["given_names", "family_name", "country"],
7575
"restrictions": [
7676
{
77-
"schema_name": "Person",
78-
"issuer_did": "QEquAHkM35w4XVT3Ku5yat"
77+
"schema_name": "Person"
7978
}
8079
]
8180
}

docker/oidc-controller/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ FROM python:3.12 AS main
22

33
WORKDIR /app/src
44

5+
# Metadata labels following OCI Image Format Specification
6+
LABEL org.opencontainers.image.title="ACA-Py VC-AuthN OIDC Controller"
7+
LABEL org.opencontainers.image.description="OpenID Connect Identity Provider powered by Verifiable Credentials using ACA-Py"
8+
LABEL org.opencontainers.image.url="https://github.com/openwallet-foundation/acapy-vc-authn-oidc"
9+
LABEL org.opencontainers.image.documentation="https://github.com/openwallet-foundation/acapy-vc-authn-oidc/blob/main/README.md"
10+
LABEL org.opencontainers.image.source="https://github.com/openwallet-foundation/acapy-vc-authn-oidc"
11+
LABEL org.opencontainers.image.vendor="OpenWallet Foundation"
12+
LABEL org.opencontainers.image.licenses="Apache-2.0"
13+
LABEL org.opencontainers.image.authors="OpenWallet Foundation"
14+
515
ENV POETRY_VIRTUALENVS_CREATE=false
616
RUN pip3 install --no-cache-dir poetry==2.0
717

0 commit comments

Comments
 (0)