From f59845fb28b282930ab97d652db19f0813abafb3 Mon Sep 17 00:00:00 2001 From: Esteban Borai Date: Tue, 13 Feb 2024 20:28:49 -0300 Subject: [PATCH] chore(cd): setup gh workflow --- .github/workflows/publish.yml | 68 +++++++++++++++++++++++++++++++++++ crates/cli/Cargo.toml | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0fb1ec1 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,68 @@ +name: Release + +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+ + +concurrency: + group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" + cancel-in-progress: true + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + publish-dry-run: + name: Test Publish with Dry Run + runs-on: ubuntu-latest + steps: + - name: Checkout Source Code + uses: actions/checkout@v4 + + - name: Setup Rust Toolchain + uses: dtolnay/rust-toolchain@stable + + - name: publish crate + run: cargo publish -p couriers --dry-run + + publish: + name: Publish Crate + runs-on: ubuntu-latest + steps: + - name: Checkout Source Code + uses: actions/checkout@v4 + + - name: Setup Rust Toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Login to Crates.io + run: cargo login ${CRATES_IO_TOKEN} + env: + CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} + + - name: Publish crate + run: cargo publish -p couriers + + release: + name: Create Release + needs: publish + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Rust Toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Create Release + id: create_release + uses: actions/github-script@v7 + with: + script: | + await github.request(`POST /repos/${{ github.repository }}/releases`, { + tag_name: "${{ github.ref }}", + generate_release_notes: true + }); diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 18eaa62..6fdeb5a 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "couriers" -version = "0.1.0" +version = "0.0.0" edition = "2021" authors = ["Esteban Borai "] publish = false