Skip to content

Commit 9f59d23

Browse files
committed
Upload releases to ga run when not tagged
1 parent 9d68a29 commit 9f59d23

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

.github/workflows/build.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
name: build
22

3-
on:
4-
merge_group:
5-
pull_request:
6-
push:
7-
branches:
8-
- master
9-
workflow_dispatch:
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: write
107

118
jobs:
129
build:
@@ -51,6 +48,13 @@ jobs:
5148
patch -p1 < ../patch/pandoc.patch
5249
cd ..
5350
51+
- name: Extract version from pandoc.cabal
52+
id: extract-version
53+
run: |
54+
VERSION=$(grep '^version:' pandoc/pandoc.cabal | awk '{print $2}')
55+
echo "Extracted version: $VERSION"
56+
echo "VERSION=$VERSION" >> $GITHUB_ENV
57+
5458
- name: gen-plan-json
5559
run: |
5660
pushd pandoc
@@ -83,12 +87,23 @@ jobs:
8387
wasmtime run --dir $PWD::/ -- dist/pandoc.wasm pandoc/README.md -o pandoc/README.rst
8488
head --lines=20 pandoc/README.rst
8589
90+
- name: Zip dist folder
91+
run: |
92+
zip -r pandoc-wasm-$VERSION.zip dist/
93+
94+
- name: Upload zipped file as artifact
95+
uses: actions/upload-artifact@v3
96+
with:
97+
name: pandoc-wasm-v$VERSION.zip
98+
path: pandoc-wasm-v$VERSION.zip
99+
86100
- name: Upload to release
101+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
87102
uses: svenstaro/upload-release-action@v2
88103
with:
89104
repo_token: ${{ secrets.GITHUB_TOKEN }}
90-
file: dist/pandoc.wasm
91-
asset_name: pandoc.wasm
105+
file: pandoc-wasm-$VERSION.zip
106+
asset_name: pandoc-wasm-$VERSION.zip
92107
tag: ${{ github.ref }}
93108
overwrite: true
94109

0 commit comments

Comments
 (0)