Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/gen-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ jobs:
uses: dawidd6/action-download-artifact@v6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: build.yml
workflow_conclusion: success
branch: main
run_id: ${{ github.event.workflow_run.id }}
name: wasm-file

- name: Compute sha and regenerate docs
Expand Down
29 changes: 21 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

permissions:
contents: write
actions: read

defaults:
run:
Expand Down Expand Up @@ -45,20 +46,32 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.workflow_run.head_sha }}

- name: Extract version from commit message
id: extract-version
- name: Extract version and find wasm artifact
id: find-artifact
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=$(git log -1 --pretty=%B | grep -oP 'Release Prep \Kv[0-9]+\.[0-9]+\.[0-9]+')
echo "Extracted version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT

ARTIFACT_NAME="wasm-${VERSION}"
RUN_ID=$(gh api "/repos/${{ github.repository }}/actions/artifacts?per_page=100" \
--jq "[.artifacts[] | select(.name == \"${ARTIFACT_NAME}\") | .workflow_run.id][0]")

if [ -z "$RUN_ID" ]; then
echo "Error: Could not find artifact ${ARTIFACT_NAME} in any workflow run" >&2
exit 1
fi

echo "Found ${ARTIFACT_NAME} in workflow run: $RUN_ID"
echo "run-id=$RUN_ID" >> $GITHUB_OUTPUT

- name: Download wasm
uses: dawidd6/action-download-artifact@v6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: gen-release-pr.yml
workflow_conclusion: success
name: wasm-${{ steps.extract-version.outputs.version }}
run_id: ${{ steps.find-artifact.outputs.run-id }}
name: wasm-${{ steps.find-artifact.outputs.version }}

- name: Calculate sha256
run: |
Expand All @@ -72,7 +85,7 @@ jobs:
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
run: |
VERSION=${{ steps.extract-version.outputs.version }}
VERSION=${{ steps.find-artifact.outputs.version }}
PREVIOUS_TAG=$(git tag --sort=-v:refname | head -1)

NOTES_FILE=$(mktemp)
Expand All @@ -86,7 +99,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
NEW_TAG=${{ steps.extract-version.outputs.version }}
NEW_TAG=${{ steps.find-artifact.outputs.version }}
mv plugin.wasm sqlc-gen-csharp.wasm

echo "Creating release ${NEW_TAG}..."
Expand Down
Loading