From 8db9298ecd1365ec35f2a3a2d7f41d8e89e63b41 Mon Sep 17 00:00:00 2001 From: Bo Lu Date: Fri, 28 Jun 2024 20:03:49 +1000 Subject: [PATCH 1/2] ci: add wasm fdw release workflow --- .github/workflows/release_wasm_fdw.yml | 80 ++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/release_wasm_fdw.yml diff --git a/.github/workflows/release_wasm_fdw.yml b/.github/workflows/release_wasm_fdw.yml new file mode 100644 index 00000000..9893f68c --- /dev/null +++ b/.github/workflows/release_wasm_fdw.yml @@ -0,0 +1,80 @@ +name: Wasm FDW Release + +on: + push: + tags: + - 'wasm_*_fdw_v[0-9]+.[0-9]+.[0-9]+' # Push events to matching wasm fdw tag, i.e. wasm_snowflake_fdw_v1.0.2 + workflow_dispatch: + inputs: + project: + description: 'Wasm FDW Project to release' + required: true + version: + description: 'Version number' + required: true + +permissions: + contents: write + +jobs: + release: + name: Create Wasm FDW Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Extract project and version from tag + id: extract_info + env: + TAG: ${{ github.ref_name }} + run: | + PROJECT=`echo "${TAG}" | sed -E 's/wasm_(.*_fdw)_v.*/\1/'` + VERSION=`echo "${TAG}" | sed -E 's/wasm_.*_fdw_(v.*)/\1/'` + echo "PROJECT=$PROJECT" >> "$GITHUB_OUTPUT" + echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Set up Rust + run: | + # install Rust + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain stable && \ + rustup --version && \ + rustc --version && \ + cargo --version + + # add wasm32-unknown-unknown target + rustup target add wasm32-unknown-unknown + + # install Wasm component + cargo install cargo-component --locked + + - name: Build Wasm FDW + run: | + cd wasm-wrappers/fdw/${{ steps.extract_info.outputs.PROJECT }} + cargo component build --release --target wasm32-unknown-unknown + + - name: Create release + id: create_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref_name }} + run: | + gh release create "$TAG" \ + --repo="$GITHUB_REPOSITORY" \ + --title=${{ steps.extract_info.outputs.PROJECT }}_${{ steps.extract_info.outputs.VERSION }} \ + --generate-notes + + - name: Get upload url + run: echo UPLOAD_URL=$(curl --silent https://api.github.com/repos/${{ github.repository }}/releases/latest | jq .upload_url --raw-output) >> $GITHUB_ENV + + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PROJECT: ${{ steps.extract_info.outputs.PROJECT }} + with: + upload_url: ${{ env.UPLOAD_URL }} + asset_path: ./wasm-wrappers/fdw/${{ env.PROJECT }}/target/wasm32-unknown-unknown/release/${{ env.PROJECT }}.wasm + asset_name: ${{ env.PROJECT }}.wasm + asset_content_type: application/wasm + From 4b53132593c443df380a94e11f64cadffa48d35d Mon Sep 17 00:00:00 2001 From: Bo Lu Date: Fri, 28 Jun 2024 20:36:11 +1000 Subject: [PATCH 2/2] remove workflow_dispatch --- .github/workflows/release_wasm_fdw.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/release_wasm_fdw.yml b/.github/workflows/release_wasm_fdw.yml index 9893f68c..e8c5bb5c 100644 --- a/.github/workflows/release_wasm_fdw.yml +++ b/.github/workflows/release_wasm_fdw.yml @@ -4,14 +4,6 @@ on: push: tags: - 'wasm_*_fdw_v[0-9]+.[0-9]+.[0-9]+' # Push events to matching wasm fdw tag, i.e. wasm_snowflake_fdw_v1.0.2 - workflow_dispatch: - inputs: - project: - description: 'Wasm FDW Project to release' - required: true - version: - description: 'Version number' - required: true permissions: contents: write