From 79f523e5ef0da5366e499329700e7fbaa860143f Mon Sep 17 00:00:00 2001 From: Francesco Pira Date: Sat, 7 Sep 2024 11:10:03 +0200 Subject: [PATCH] CI and Release pipelines --- .github/workflows/ci.yml | 28 ++++++++++++++++ .github/workflows/release.yml | 60 +++++++++++++++++++++++++++++++++++ .gitignore | 2 +- 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e505390 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: CI + +on: + pull_request: + branches: + - main + paths: + - .cargo/** + - src/** + - Cargo.lock + - Cargo.toml + - .github/workflows/ci.yml + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - name: Clone repo + uses: actions/checkout@v4 + + - name: Setup Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + target: wasm32-wasi + + - name: Build project + run: cargo build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..85fa77d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,60 @@ +name: Release + +on: + push: + branches: + - main + paths: + - .cargo/** + - src/** + - Cargo.lock + - Cargo.toml + - .github/workflows/ci.yml + +jobs: + build-and-release: + runs-on: ubuntu-latest + steps: + - name: Clone repo + uses: actions/checkout@v4 + + - name: Get app name + id: name + run: | + echo "name=zellij-jump-list" >> $GITHUB_OUTPUT + + - name: Get app version + id: version + run: | + APP_VERSION=$(git rev-parse --short HEAD) + CURRENT_DATE=$(date +'%Y.%m.%d') + APP_VERSION_DATE="${CURRENT_DATE}-${APP_VERSION}" + echo "version=$APP_VERSION_DATE" + echo "version=$APP_VERSION_DATE" >> $GITHUB_OUTPUT + + - name: Setup Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + target: wasm32-wasi + + - name: Build release + run: cargo build --release + + - name: Generate SHA256 checksum + run: sha256sum ./target/wasm32-wasi/release/zellij-jump-list.wasm > ./target/wasm32-wasi/release/zellij-jump-list.wasm.sha256 + + - name: Create release and upload assets + uses: softprops/action-gh-release@v2 + with: + files: | + ./target/wasm32-wasi/release/zellij-jump-list.wasm + ./target/wasm32-wasi/release/zellij-jump-list.wasm.sha256 + name: ${{ steps.version.outputs.version }} + tag_name: ${{ steps.version.outputs.version }} + generate_release_notes: true + draft: false + prerelease: false + # Note: drafts and prereleases cannot be set as latest. + make_latest: true + fail_on_unmatched_files: true diff --git a/.gitignore b/.gitignore index ea8c4bf..eb5a316 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/target +target