From b42f7c540696f55c7aab492023e977e3da32f087 Mon Sep 17 00:00:00 2001 From: jofas Date: Sat, 22 Apr 2023 18:19:24 +0200 Subject: [PATCH] publish action --- .github/workflows/publish.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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..6416a8c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+ +permissions: + contents: read +jobs: + Publish: + runs-on: ubuntu-latest + container: + image: rust:latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Load cache + uses: Swatinem/rust-cache@v2 + with: + key: publish + - name: Install toml-cli + run: cargo install toml-cli + - name: Extract Cargo.toml Version + run: echo "VERSION=$(toml get -r Cargo.toml package.version)" >> "$GITHUB_ENV" + - name: Check Version + run: [ "${{ format('v{0}', env.CARGO_VERSION) }}" == "${{ github.ref_name }}" ] + - name: Publish + run: cargo publish + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}