From ebd7fa5e2d9fe65bd42cec8ce70a0f47004e9da9 Mon Sep 17 00:00:00 2001 From: Pavel Borzenkov Date: Mon, 9 Oct 2023 11:04:03 +0200 Subject: [PATCH] ci: add release steps - upload binary artifacts to GH release page - publish NPM packages --- .github/workflows/push.yml | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 26305e2..6b0c3a1 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,5 +1,8 @@ name: "Push" on: + release: + types: + - created push: branches: - main @@ -72,6 +75,11 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + - id: release + uses: bruceadams/get-release@v1 + if: github.event_name == 'release' + env: + GITHUB_TOKEN: ${{ github.token }} - uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} @@ -107,6 +115,17 @@ jobs: path: target/${{ matrix.target }}/release/${{ matrix.soname }} if-no-files-found: error + - name: Upload release + uses: actions/upload-release-asset@v1 + if: github.event_name == 'release' + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.release.outputs.upload_url }} + asset_path: target/${{ matrix.target }}/release/litevfs-${{ env.VERSION }}-${{ matrix.target }}.tar.gz + asset_name: litevfs-${{ env.VERSION }}-${{ matrix.target }}.tar.gz + asset_content_type: application/gzip + build-wasm: name: "Build WASM" runs-on: "ubuntu-latest" @@ -116,6 +135,11 @@ jobs: steps: - uses: actions/checkout@v4 + - id: release + uses: bruceadams/get-release@v1 + if: github.event_name == 'release' + env: + GITHUB_TOKEN: ${{ github.token }} - uses: dtolnay/rust-toolchain@stable with: targets: wasm32-unknown-emscripten @@ -146,6 +170,17 @@ jobs: path: target/sqlite3-wasm if-no-files-found: error + - name: Upload release + uses: actions/upload-release-asset@v1 + if: github.event_name == 'release' + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.release.outputs.upload_url }} + asset_path: target/sqlite3-wasm-${{ env.VERSION }}.tar.gz + asset_name: sqlite3-wasm-${{ env.VERSION }}.tar.gz + asset_content_type: application/gzip + build-npm: name: "Build NPM packages" runs-on: "ubuntu-latest" @@ -179,3 +214,13 @@ jobs: name: npm-packages-${{ env.VERSION }} path: target/npm if-no-files-found: error + + - name: Publish NPM packages + if: github.event_name == 'release' + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + cd target/npm + for p in litevfs-*.tgz; do + npm publish $p + done \ No newline at end of file