Skip to content

Commit c4d19ba

Browse files
authored
Fix release workflow (#98)
* Removed 0% test * Update release.yml * Update release.yml
1 parent a813956 commit c4d19ba

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ jobs:
2424
working-directory: plugin
2525
run: GOOS=wasip1 GOARCH=wasm go build -o ../sqlc-gen-better-python.wasm
2626

27+
- name: Calculate SHA256 hash
28+
id: hash
29+
run: |
30+
HASH=$(sha256sum sqlc-gen-better-python.wasm | awk '{ print $1 }')
31+
echo "sha256=$HASH" >> $GITHUB_OUTPUT
32+
2733
- name: Get the latest version
2834
id: latest
2935
uses: miniscruff/changie-action@v2
@@ -32,49 +38,42 @@ jobs:
3238
args: latest
3339

3440
- name: Create tag
41+
id: tag
3542
run: |
3643
git tag ${{ steps.latest.outputs.output }}
3744
git push origin ${{ steps.latest.outputs.output }}
45+
DOWNLOAD_URL="https://github.com/rayakame/sqlc-gen-better-python/releases/download/${{ steps.latest.outputs.output }}/sqlc-gen-better-python.wasm"
46+
echo "download_url=$DOWNLOAD_URL" >> $GITHUB_OUTPUT
3847
3948
- name: Update README with new version and checksum
4049
run: |
41-
cd ${{ github.workspace }}
42-
version=${{ steps.latest.outputs.output }}
43-
export checksum=$(sha256sum sqlc-gen-better-python.wasm | awk '{print $1}')
44-
export escaped_url="https://github.com/rayakame/sqlc-gen-better-python/releases/download/${version}/sqlc-gen-better-python.wasm"
45-
46-
sed -i -E "s|(url: ).*|url: ${escaped_url}|" README.md
47-
sed -i -E "s|(sha256: )[a-f0-9]+|\1${checksum}|" README.md
50+
sed -i -E "s|(url: ).*|url: ${{ steps.tag.outputs.download_url }}|" README.md
51+
sed -i -E "s|(sha256: ).*|sha256: ${{ steps.hash.outputs.sha256 }}|" README.md
4852
4953
- name: Create PR to update README
5054
uses: peter-evans/create-pull-request@v7
5155
with:
5256
commit-message: "chore: update README example with v${{ steps.latest.outputs.output }}"
5357
branch: "release/update-readme-${{ steps.latest.outputs.output }}"
5458
title: "Update README for release ${{ steps.latest.outputs.output }}"
59+
add-paths: |
60+
README.md
5561
body: |
5662
This PR updates the README example config with:
5763
- WASM plugin version: `${{ steps.latest.outputs.output }}`
58-
- SHA256 checksum: `${checksum}`
64+
- SHA256 checksum: `${{ steps.hash.outputs.sha256 }}`
5965
6066
Auto-generated during the release workflow.
6167
62-
- name: Build plugin again
63-
working-directory: plugin
64-
run: GOOS=wasip1 GOARCH=wasm go build -o ../sqlc-gen-better-python.wasm
65-
6668
- name: Generate release description
6769
run: |
68-
cd ${{ github.workspace }}
69-
export checksum=$(sha256sum sqlc-gen-better-python.wasm | awk '{print $1}')
70-
export download_url="https://github.com/rayakame/sqlc-gen-better-python/releases/download/${{ steps.latest.outputs.output }}/sqlc-gen-better-python.wasm"
7170
72-
yq -i '.plugins[0].wasm.url = env(download_url)' .github/release_output_template.yaml
73-
yq -i '.plugins[0].wasm.sha256 = env(checksum)' .github/release_output_template.yaml
71+
yq -i '.plugins[0].wasm.url = ${{ steps.tag.outputs.download_url }}' .github/release_output_template.yaml
72+
yq -i '.plugins[0].wasm.sha256 = ${{ steps.hash.outputs.sha256 }}' .github/release_output_template.yaml
7473
7574
# Create the release body with the warning message at the top
7675
echo "> [!WARNING]" > release_body.md
77-
echo "> Every Release before \`v1.0.0\`, including this one is an **early alpha release**. Currently, there is 0% test coverage and these versions are only released for interested people who want to test this plugin and help make it better." >> release_body.md
76+
echo "> Every Release before \`v1.0.0\`, including this one is an **early alpha release**. These versions are only released for interested people who want to test this plugin and help make it better." >> release_body.md
7877
7978
# Add the release changelog and YAML content below the warning message
8079
cat .changes/${{ steps.latest.outputs.output }}.md >> release_body.md

0 commit comments

Comments
 (0)