Skip to content

Commit

Permalink
chore: publish on tag push
Browse files Browse the repository at this point in the history
  • Loading branch information
EstebanBorai committed Jun 21, 2024
1 parent 5f3662c commit 560f58f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 33 deletions.
36 changes: 5 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
type: choice
required: true
description: 'Version number to bump'
options:
- patch
- minor
- major
push:
tags:
- "v*"


permissions:
contents: write
Expand Down Expand Up @@ -47,26 +41,6 @@ jobs:
toolchain: stable
override: true

- name: Install `cargo-edit`
run: cargo install cargo-edit

- id: cargo-set-version
name: Set Version
run: cargo set-version --bump ${{ inputs.version }}

- name: Set Crate Version as Environment Variable
run: |
CARGO_TOML_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/[\"]/, "", $2); printf("%s",$2) }' Cargo.toml)
echo "CRATE_VERSION=$CARGO_TOML_VERSION" >> $GITHUB_ENV
- name: Create Commit
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "chore: bump version to v$CRATE_VERSION"
git push origin main --follow-tags
- name: Login to Crates.io
run: cargo login ${CRATES_IO_TOKEN}
env:
Expand All @@ -81,6 +55,6 @@ jobs:
with:
script: |
await github.request(`POST /repos/${{ github.repository }}/releases`, {
tag_name: "v${{ env.CRATE_VERSION }}",
tag_name: "${{ github.ref }}",
generate_release_notes: true
});
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "http-server"
version = "0.8.8"
version = "0.8.9"
authors = ["Esteban Borai <estebanborai@gmail.com>"]
edition = "2021"
description = "Simple and configurable command-line HTTP server"
Expand Down

0 comments on commit 560f58f

Please sign in to comment.